collect errors occurring in a specific JS file #5154
-
I’m trying to add Sentry on an application that consists of a single JS file which can be imported via a If I simply add Sentry to the application, it collects all errors occurring on websites that the application is installed on. Is there any way to collect errors that occurred in just the application? I found an information but it seemed to be for a previous version of Sentry SDK. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @tetsushi-ito, you would have to create a custom client and instrument your script manually. Here is your solution with our newest version v7 (currently in beta): import { BrowserClient, defaultStackParser, makeFetchTransport } from '@sentry/browser';
const client = new BrowserClient({
dsn: "__YOUR_DSN__",
transport: makeFetchTransport,
stackParser: defaultStackParser,
}); It is important not to use any default integrations. And afterwards, feel free to use any of our client API methods. try {
aFunctionThatMightFail();
} catch (err) {
client.captureException(err);
} |
Beta Was this translation helpful? Give feedback.
Hey @tetsushi-ito, you would have to create a custom client and instrument your script manually.
Here is your solution with our newest version v7 (currently in beta):
It is important not to use any default integrations.
And afterwards, feel free to use any of our client API methods.
Docs here