Skip to content

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Sep 11, 2025

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.

exception_id: 1,
parent_id: 0,
source: 'cause',
});
Copy link

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)

Fix in Cursor Fix in Web

Copy link
Member Author

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

Copy link
Member

@s1gr1d s1gr1d left a 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!

Comment on lines +17 to +33
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 });
Copy link
Member Author

@Lms24 Lms24 Sep 11, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants