-
-
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.
refactor: assign correct sentry scoping
--- 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]>
- Loading branch information
1 parent
9eb9ac7
commit 6797ed6
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