IBX-5027: Added logging exceptions for REST #45
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
v4.4
Our REST API does not log exceptions when they occur, making it harder to debug requests.
While it is possible to read stacktrace in th REST response, it is cumbersome and requires response to actually remain somewhere (which might not always be the case).
Instead, I suggest we log exceptions in a similar fashion as built-in Symfony's ErrorListener service does it.
Ideally, we would simply allow ErrorListener to run and log exceptions this way (it registers itself with priority 0 and -128, for logging and generating response respectively), but that would be a BC break on our side, because we would need to change several service priorities - which might mess up our users configurations, if they rely on us having exception listeners with specific priorities.
Currently:
![image](https://user-images.githubusercontent.com/3183926/216986476-0c70095d-5948-4603-ad36-c4d16685cf5e.png)
![image](https://user-images.githubusercontent.com/3183926/216986530-08e0e7d9-517a-48a9-8eb4-bb55cfaecd60.png)
I would expect to have instead:
TODO:
$ composer fix-cs
).