-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(nuxt): Add and adjust mechanism.type
in error events
#17599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
exception_id: 1, | ||
parent_id: 0, | ||
source: 'cause', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Incorrect Error Mechanism Type in Tests
The nuxt-3
server error tests in errors.server.test.ts
incorrectly expect exception0.mechanism.type
to be 'chained'
. It should be 'auto.function.nuxt.nitro'
to align with the captureErrorHook.ts
implementation and other Nuxt test applications.
Additional Locations (1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my local e2e test run disagrees but I agree this is incredibly weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for adding this!
const exception0 = error.exception.values[0]; | ||
const exception1 = error.exception.values[1]; | ||
|
||
expect(exception0.type).toEqual('Error'); | ||
expect(exception0.value).toEqual('Nuxt 3 Server error'); | ||
expect(exception0.mechanism).toEqual({ | ||
handled: false, | ||
type: 'auto.function.nuxt.nitro', | ||
exception_id: 1, | ||
parent_id: 0, | ||
source: 'cause', | ||
}); | ||
|
||
expect(exception1.type).toEqual('Error'); | ||
expect(exception1.value).toEqual('Nuxt 3 Server error'); | ||
// TODO: This isn't correct but requires adjustment in the core SDK | ||
expect(exception1.mechanism).toEqual({ handled: true, type: 'generic', exception_id: 0 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this is an interesting one: Apparently we capture two linked errors for these server errors. I didn't know this but I guess this is somehow related to useFetch
(?)
I thought the mechanism type incorrectly falls back to generic
via linkedErrorsIntegration()
but it doesn't seem to be the cause. It can't come from the Nuxt SDK itself (I didn't find any other captureException calls) and our nodeFetchInstrumentation
doesn't do it either. So not yet sure where this is coming from but we'll get there eventually.
This PR adjusts/adds the
mechanism.type
field to errors caught from our Nuxt SDK. The name now follows the trace origin as well as possible.