Skip to content

Improper Exception Handling in _closeSession Function  #132

Closed
@eXorus

Description

@eXorus

The _closeSession function within the Webdriver module of Codeception is currently not handling exceptions properly. Over the past few weeks, I have noticed that certain exceptions are not being caught as expected, leading the program to terminate with an error.

  • Codeception 5.1.2
  • module-webdriver: 4.0.1
  • php-webdriver: 1.15.1
In WebDriverException.php line 110:
                                                                               
  [Facebook\WebDriver\Exception\InvalidSessionIdException]                     
  Unable to find session with ID: 8fd10b945a0b485d9fd495df631f3657             
  Build info: version: '4.22.0', revision: 'c5f3146703'                        
  System info: os.name: 'Linux', os.arch: 'aarch64', os.version: '4.14.343-26  
  1.564.amzn2.aarch64', java.version: '17.0.11'                                
  Driver info: driver.version: unknown                                         
                                                                               

Exception trace:
  at /project/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:110
 Facebook\WebDriver\Exception\WebDriverException::throwException() at /project/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:359
 Facebook\WebDriver\Remote\HttpCommandExecutor->execute() at /project/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:601
 Facebook\WebDriver\Remote\RemoteWebDriver->execute() at /project/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:326
 Facebook\WebDriver\Remote\RemoteWebDriver->quit() at /project/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php:1748
 Codeception\Module\WebDriver->_closeSession() at /project/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php:763
 Codeception\Module\WebDriver->stopAllSessions() at /project/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php:757
 Codeception\Module\WebDriver->_afterSuite() at /project/vendor/codeception/codeception/src/Codeception/Subscriber/Module.php:59
 Codeception\Subscriber\Module->afterSuite() at /project/vendor/symfony/event-dispatcher/EventDispatcher.php:220
 Symfony\Component\EventDispatcher\EventDispatcher->callListeners() at /project/vendor/symfony/event-dispatcher/EventDispatcher.php:56
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at /project/vendor/codeception/codeception/src/Codeception/SuiteManager.php:153
 Codeception\SuiteManager->run() at /project/vendor/codeception/codeception/src/Codeception/Codecept.php:260
 Codeception\Codecept->runSuite() at /project/vendor/codeception/codeception/src/Codeception/Codecept.php:248
 Codeception\Codecept->run() at /project/vendor/codeception/codeception/src/Codeception/Command/Run.php:646
 Codeception\Command\Run->runSuites() at /project/vendor/codeception/codeception/src/Codeception/Command/Run.php:467
 Codeception\Command\Run->execute() at /project/vendor/symfony/console/Command/Command.php:326
 Symfony\Component\Console\Command\Command->run() at /project/vendor/symfony/console/Application.php:1078
 Symfony\Component\Console\Application->doRunCommand() at /project/vendor/symfony/console/Application.php:324
 Symfony\Component\Console\Application->doRun() at /project/vendor/symfony/console/Application.php:175
 Symfony\Component\Console\Application->run() at /project/vendor/codeception/codeception/src/Codeception/Application.php:112
 Codeception\Application->run() at /project/vendor/codeception/codeception/app.php:45
 {closure}() at /project/vendor/codeception/codeception/app.php:46
 require() at /project/vendor/codeception/codeception/codecept:7
 include() at /project/vendor/bin/codecept:119

Do you have the same issue on your side ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions