-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
8.48.0
Framework Version
react 18.3.1, next 14.24.2
Link to Sentry event
Reproduction Example/SDK Setup
https://codesandbox.io/p/sandbox/nervous-brattain-kzpr8z
export class CustomError extends Error {
userErrorMessage: string;
name = "CustomError";
constructor(
message: string,
userErrorMessage?: RelocationUserErrorMessage,
cause?: unknown
) {
super(message, { cause });
this.userErrorMessage = userErrorMessage || "Something went wrong";
}
}
Steps to Reproduce
- Throw an error in 1 file
- Catch an error in another file and create new error passing original error as cause
- Capture new custom error with sentry
Expected Result
When console.logging the custom error, the stack trace of the cause includes a line where it was thrown, however when viewing the sentry, the stack trace of cause is missing 1 line, so it's hard to see where the error originated.
Example:
Here how it is displayed in Sentry

And here how it is displayed in console

As you see 1 line in the cause stack trace is missing in sentry, specifically this line:
at generateAreaInfoAction (generateAreaInfoAction.ts:21:11)
Actual Result
The whole stack trace to be included in Sentry for cause
error
It appears that sentry displays the custom error's stack instead of stack of the cause
, and only the first line (error name and message) of the cause
is displayed, with the rest of the stack being displayed on sentry is taken from the actual error and not the cause
error
Metadata
Metadata
Assignees
Labels
Projects
Status