-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with exception display on command line #24
Comments
@lukenm I looked into that issue and figured out why you only get the topmost exception. If you run your script from cli, most likely your xdebug exception handler will kick in for unhandled exceptions. Per default the stacktrace for errors or exceptions is disabled in xdebug. To properly debug your script try to change your xdebug configurations as follows (don't forget to restart fpm or whatever you use):
Then you should get something similar to this:
Which is the correct exception chain from top > down. As for the questions:
|
Hi @lukenm do you need any further information on this? |
@lukenm ping. Closing this on Wednesday |
Closed due to inactivity. |
Hi there, would appreciate a discussion regarding this issue, thanks. On master, ref
a1e3bd9
.Expected:
Actual:
I've had some trouble trying to work this one out. I think it has something to do with the exception chaining. I've tried to create a simple test case to isolate the issue outside of the php-deal framework, but haven't been successful - my isolated tests with exception chaining always work as expected, with separate messages for each exception thrown. When running tests with the php-deal framework, the ContractViolation exception is always missing from the cli output.
When I step through the code, the ContractViolation appears to be created correctly, and I can catch it in the outer scope. It seems to be a problem with the way PHP is displaying the exceptions and stack trace.
To recreate the issue, apply the following patch, and run the demo:
I can temporarily get things working as expected by disabling the exception chaining as follows:
Some questions:
ContractViolation
exceptions. Does it make sense to chain the exceptions in this way? To me it would seem better to catch theDomainException
atAspect/AbstractContractAspect.php:89
, and throw aContractViolation
exception without chaining (theDomain Exception
doesn't appear to convey any useful information to the developer).Error
orException
types should be handled differently? It might make sense to have a different exception type in the case the syntax/parsing of the contract failed.\Error $internalError
atAspect/AbstractContractAspect.php:89
and chaining it inAspect/AbstractContractAspect.php:91
will fail due to the type hint inException/ContractViolation.php:29
. I didn't see a test case for that -Aspect/AbstractContractAspect.php:91
isn't included in the code coverage.The text was updated successfully, but these errors were encountered: