-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: assign correct sentry scoping (#272)
Updates sentry to properly create scopes for handling each command, as well as the event based handlers like reactions. Bumps the sentry group with 2 updates in the / directory: [@sentry/node](https://github.com/getsentry/sentry-javascript) and [@sentry/profiling-node](https://github.com/getsentry/sentry-javascript). Updates `@sentry/node` from 7.113.0 to 8.1.0 - [Release notes](https://github.com/getsentry/sentry-javascript/releases) - [Changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md) - [Commits](getsentry/sentry-javascript@7.113.0...8.1.0) Updates `@sentry/profiling-node` from 7.113.0 to 8.1.0 - [Release notes](https://github.com/getsentry/sentry-javascript/releases) - [Changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md) - [Commits](getsentry/sentry-javascript@7.113.0...8.1.0) --- updated-dependencies: - dependency-name: "@sentry/node" dependency-type: direct:production update-type: version-update:semver-major dependency-group: sentry - dependency-name: "@sentry/profiling-node" dependency-type: direct:production update-type: version-update:semver-major dependency-group: sentry ... Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9eb9ac7
commit f38d1e1
Showing
11 changed files
with
869 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
import * as Sentry from '@sentry/node'; | ||
|
||
interface ReportOptions { | ||
userId?: string; | ||
extra?: Record<string, any>; | ||
} | ||
type ScopeFn = (scope: Sentry.Scope) => void; | ||
|
||
export const sentryReport = ( | ||
error: unknown, | ||
{ userId, extra }: ReportOptions = {}, | ||
) => { | ||
Sentry.withScope((scope) => { | ||
userId && scope.setUser({ id: userId }); | ||
Sentry.captureException(error, { extra }); | ||
}); | ||
/** | ||
* @param error The error to report | ||
* @param scopeFn Optional function to modify the scope before sending the report | ||
*/ | ||
export const sentryReport = (error: unknown, scopeFn?: ScopeFn) => { | ||
const scope = Sentry.getCurrentScope(); | ||
scope.captureException(error); | ||
scopeFn?.(scope); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters