Reputation: 119
I have integrated sentry on one of my NextJS application and using captureException in the catch block to capture exceptions on the platform. Still it is not logging out all the nested error object fields rather it is logging only the error message. Tried other various functions as well but none of them is fulfilling my use case.
Tried all workarounds but got no help. Following is the code, I have used
catch (error) {
console.log("log message", error);
console.error("error message", error);
console.log("log message", JSON.stringify(error));
console.error("error message", JSON.stringify(error));
Sentry.addBreadcrumb({
message: 'Breadcrumb message 1',
});
Sentry.captureMessage('Message 1');
Sentry.captureException('Error 1');
Sentry.captureException(error);
Sentry.captureException(new Error(error));
Sentry.captureEvent({
message: 'Manual'
});
Sentry.captureEvent(error);
Sentry.captureEvent(new Error(error));
}
Checked sentry docs and forums but got no help from there as well. If there is any other solution also, please let me know
Upvotes: 1
Views: 3220
Reputation: 119
I have got the solution. You can use ExtraErrorData as following in Sentry.init method for this
import { ExtraErrorData } from "@sentry/integrations";
integrations: [
new ExtraErrorData({ depth: 10 })
]
Upvotes: 1