Detailed logging of invalid requests#247
Open
matthijskooijman wants to merge 2 commits intoopensensorhub:masterfrom
Open
Detailed logging of invalid requests#247matthijskooijman wants to merge 2 commits intoopensensorhub:masterfrom
matthijskooijman wants to merge 2 commits intoopensensorhub:masterfrom
Conversation
ac8c8a5 to
82cc7dd
Compare
Author
|
Note that identical code exists in |
Previously, just the exception message was logged. For some exceptions,
this is quite non-descript, for example:
2024-01-25 06:17:14.061 DEBUG [SWAPool-1] - Invalid request (BAD_PAYLOAD): Invalid payload: Invalid XML: Received event END_DOCUMENT, instead of START_ELEMENT or END_ELEMENT.
To solve this error, a backtrace is needed to figure out what was
expected exactly.
This particular exception message could probably be improved by itself,
but this commit solves this more generically, since there might be other
exceptions suffering from the same issue.
This commit changes the handling of InvalidRequestExceptions to use the
existing `logError()` function. This logs details of the request and
a backtrace. To ensure that this does not log "Internal server error"
but keep the existing "Invalid request", `logError()` is refactored to
accept an error prefix.
For some exceptions, the cause backtrace provides necessary details for debugging the actual cause of the issue, since the message is not always detailed enough.
6839697 to
5a70843
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently, some problems while parsing the payload generate fairly non-descript exceptions, where the message itself is not enough to diagnose the problem (see commit message for details). This PR ensures that on an InvalidRequestException, more details about the request and an exception backtrace is logged (see commit messages for details).