Skip to content

Ensure that path is not NULL and throw appropriate error #121

@dantleech

Description

@dantleech

Somebody tried to use WS 0.1.x before upgrading to 0.2.x. After upgrading the following Fatal Error surfaced:

Fatal error: Uncaught TypeError: my127\Workspace\Types\Harness\Definition::getPath(): Return value must be of type string, null returned in phar:///usr/local/bin/ws/src/Types/Harness/Definition.php:38
Stack trace:
#0 phar:///usr/local/bin/ws/src/Types/Harness/Path.php(25): my127\Workspace\Types\Harness\Definition->getPath()
#1 phar:///usr/local/bin/ws/src/Path/Composite.php(19): my127\Workspace\Types\Harness\Path->getRealPath('harness:/')
#2 phar:///usr/local/bin/ws/src/Types/Workspace/Installer.php(259): my127\Workspace\Path\Composite->getRealPath('harness:/')
#3 phar:///usr/local/bin/ws/src/Types/Workspace/Installer.php(124): my127\Workspace\Types\Workspace\Installer->applyOverlayDirectory('tools/workspace')
#4 phar:///usr/local/bin/ws/src/Types/Workspace/Workspace.php(91): my127\Workspace\Types\Workspace\Installer->install('2', true, true)
#5 phar:///usr/local/bin/ws/src/Types/Workspace/Builder.php(120): my127\Workspace\Types\Workspace\Workspace->install(Object(my127\Console\Usage\Input))
#6 phar:///usr/local/bin/ws/vendor/my127/my127/src/Console/src/Application/Executor.php(202): my127\Workspace\Types\Workspace\Builder->my127\Workspace\Types\Workspace\{closure}(Object(my127\Console\Usage\Input))
#7 phar:///usr/local/bin/ws/vendor/my127/my127/src/Console/src/Application/Executor.php(108): my127\Console\Application\Executor->invokeAction(Object(Closure))
#8 phar:///usr/local/bin/ws/vendor/my127/my127/src/Console/src/Application/Application.php(128): my127\Console\Application\Executor->run(Object(my127\Console\Application\Section\Section), Array)
#9 phar:///usr/local/bin/ws/src/Application.php(26): my127\Console\Application\Application->run(Array)
#10 phar:///usr/local/bin/ws/src/Types/Workspace/Workspace.php(105): my127\Workspace\Application->run(Array)
#11 phar:///usr/local/bin/ws/src/Types/Workspace/Installer.php(156): my127\Workspace\Types\Workspace\Workspace->run('install --step=...')
#12 phar:///usr/local/bin/ws/src/Types/Workspace/Workspace.php(91): my127\Workspace\Types\Workspace\Installer->install('1', true, true)
#13 phar:///usr/local/bin/ws/src/Types/Workspace/Builder.php(120): my127\Workspace\Types\Workspace\Workspace->install(Object(my127\Console\Usage\Input))
#14 phar:///usr/local/bin/ws/vendor/my127/my127/src/Console/src/Application/Executor.php(202): my127\Workspace\Types\Workspace\Builder->my127\Workspace\Types\Workspace\{closure}(Object(my127\Console\Usage\Input))
#15 phar:///usr/local/bin/ws/vendor/my127/my127/src/Console/src/Application/Executor.php(108): my127\Console\Application\Executor->invokeAction(Object(Closure))
#16 phar:///usr/local/bin/ws/vendor/my127/my127/src/Console/src/Application/Application.php(128): my127\Console\Application\Executor->run(Object(my127\Console\Application\Section\Section), Array)
#17 phar:///usr/local/bin/ws/src/Application.php(26): my127\Console\Application\Application->run(Array)
#18 phar:///usr/local/bin/ws/bin/workspace(17): my127\Workspace\Application->run()
#19 phar:///usr/local/bin/ws/bin/workspace(49): main()
#20 /usr/local/bin/ws(14): require('phar:///usr/loc...')
#21 {main}
  thrown in phar:///usr/local/bin/ws/src/Types/Harness/Definition.php on line 38

This seems to have been a residual state issue from .my127 with 0.1.x.

This ticket is to improve the error handling for the above, for example by providing more context on the definition that was invalid.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions