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.
This address the issue described here:
#376
Setting a expected_status_code will not mark an error as expected when there is an exception in the transaction.
The problem starts here with
markedExpected
:newrelic-java-agent/newrelic-agent/src/main/java/com/newrelic/agent/errors/ErrorServiceImpl.java
We only check whether it's expected on the Throwable and do not consult the expected status codes....As @meiao hinted on
ThrowableError
andHttpTracedError
.Essentially, we should check if the throwable OR a status code is expected and mark it as such. This change does that.
Overview
checks both response status and throwable for if they were configured to be expected. Previously, we were not checking the response status in this code path, so there are cases where a response status can be configured expected, but the TracedError will not get created as expected.
Related Github Issue
#376
Checks
[ NA] Are your contributions backwards compatible with relevant frameworks and APIs?
[ no] Does your code contain any breaking changes? Please describe.
[ no] Does your code introduce any new dependencies? Please describe.