-
-
Notifications
You must be signed in to change notification settings - Fork 570
Add Debug::RETHROW_UNSAFE_EXCEPTIONS flag #337
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
Conversation
src/Error/FormattedError.php
Outdated
if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) { | ||
$isInternal = ! $e instanceof ClientAware || ! $e->isClientSafe(); | ||
|
||
if (($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) && $isInternal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this changes the behaviour? What is the rational for this?
What if I may want/desire the current behaviour and not differentiating internal exceptions?
The semantics of the current behaviour is off.
I do have an Exception that implements `ClientAware` and `isClientSafe() === true`, thus it is seen as not internal. I expect it to not be rethrown. Currently it is.
As of now, a more accurate name for the flag would be `RETHROW_EXCEPTIONS_THAT_ARE_NOT_INSTANCES_OF_GRAPHQL_ERROR_ERROR`
|
@spawnia I'd like to keep it backward compatible. Can you add |
I assume the point of Now, the This is why i think the current behaviour is faulty and what i propose is a valid fix for that bug. It is a change in behaviour, yes, but it only affects a small slice of users, and only if Debugging is enabled. Production use will not break as a result of this. |
@spawnia Not really. Internal exception is an exception that is stored in To sum up:
I guess it makes sense to update variable names accordingly. |
That makes sense. I agree we should get rid of the naming mismatch. How would i go about adding the new Debug flag |
Yeah, it should be the next power of 2 (since we use bitwise operations there). In our case it's |
This allows for a more granular default for which Exceptions are thrown, taking the settings made through the ClientAware interface into account. - Add docs - Add a test case - Differentiate clearly from other test
Can this be done automatically?
Nice, thank you! |
This allows for a more granular default for which Exceptions are thrown, taking
the settings made through the ClientAware interface into account.