fix(nuxt): check for H3 error cause before re-capturing #18035
Merged
+166
−0
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.
The flakey tests in nuxt-4 pointed out that we have a race condition where a middleware error can bubble up as an H3 event error, which wraps the original error we caught.
This means the
checkOrSetAlreadyCaughtwon't actually detect it since it doesn't check the.causeproperty.I added the logic needed for that for the Nuxt SDK but feels like this may come up later if it hadn't already.
Note that this does not affect the spans created, just the mechanism of the caught error, the spans would still be marked correctly as errored.