Do not throw no archive exception for API requests triggered by the UI #20465
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.
Description:
When a report or an UI widget directly queries the API using a segment, it can currently happen that an UnprocessedSegmentException is thrown in the API if no usable archive can be found.
This would currently be displayed directly in the UI, as the AjaxHelper by default shows every error as notification.
As our UI has an additional way to determine if reports have been processed or not, resulting in a separate notification, there is no benefit in throwing the UnprocessedSegmentException for API requests triggered by the UI.
I've therefor changed the AjaxHelper so a XMLHttpRequest header will be sent with all requests and added some code to not throw the UnprocessedSegmentException for such requests.
Requests triggered from the UI will instead now receive the normal report with 0 values.
fixes #20222
Review