[java] Rescuing the remote cause for session creation errors by diemol · Pull Request #16418 · SeleniumHQ/selenium

User description

🔗 Related Issues

Fixes #16388

💥 What does this PR do?

Every now and then, someone complains because the real reason a remote session creation fails is hidden in the stack trace. This identifies the cause, if it exists, and displays it at the top level.


PR Type

Bug fix


Description

  • Improved error messaging for remote session creation failures

  • Extracts and displays the underlying cause message at the top level

  • Prevents real error reasons from being hidden in stack traces


Diagram Walkthrough

flowchart LR
  A["Session Creation Error"] --> B["Check for Cause"]
  B --> C["Extract Cause Message"]
  C --> D["Display at Top Level"]
Loading

File Walkthrough

Relevant files
Bug fix
RemoteWebDriver.java
Enhanced remote session error message extraction                 

java/src/org/openqa/selenium/remote/RemoteWebDriver.java

  • Enhanced error handling in execute() method for NEW_SESSION command
  • Extracts cause message from exception chain when available
  • Appends cause message to SessionNotCreatedException for better
    visibility
+5/-1