Description
- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
Package + Version
-
@sentry/browser
-
@sentry/node
-
raven-js
-
raven-node
(raven for node) - other:
Version:
5.0.8
Description
Hi,
I'm not sure if I'm using this the right way, but I couldn't find any documentation that addresses what I want to do. I'm using Sentry in a NodeJS process, and while it uses ExpressJS, it also does execute some functions without ExpressJS, so in the backend. I want to check these processes for errors, but in a new "scope". So, at the start of executing of a function until it's executed, it's a new scope.
For example:
Sentry.withScope(scope => {
scope.setLevel('error');
scope.clear();
scope.clearBreadcrumbs();
executeAPromisedFunction(parameters).then(response => {
Sentry.addBreadcrumb({
message: 'Promised function executed',
level: "info"
});
anotherPromisedFunction(parameters).then(response => {
// Finished execution, nothing to see here!
}).catch(err => {
// An error occured here! Sent this to Sentry!
Sentry.captureException(err);
})
}).catch(err => {
// An error occured! So sent this to Sentry!
Sentry.captureException(err);
})
});
What I believe should happen
New issue created on error, with a breadcrumb if first function executed fine but second is not. Or don't send a issue when everything went fine. But don't add any breadcrumbs from other functions, like console.log etc.
What actually happens
An issue is send to Sentry with all breadcrumbs, like console.logs, which I don't need. I just want a scope that only contains information about this execution. I don't want any info about other executed files or console.log breadcrumbs.
Is this possible? And is this a bug or is it supposed to do this?