GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(nuxt): Add server error hook by s1gr1d · Pull Request #12796 · getsentry/sentry-javascript Conversation
|
|
|
||
| if (context) { | ||
| captureException(error, { | ||
| captureContext: { contexts: { nuxt: context } }, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
m: I would be more selective in what we record here instead of dumping the entire context object in here. It could become a problem if context suddenly starts containing PII, becomes very large, or circular in a future nitro update.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
yes ideally we:
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
![]()
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // Do not handle 404 and 422 | ||
| if (error instanceof H3Error) { | ||
| if (error.statusCode === 404 || error.statusCode === 422) { | ||
| return; | ||
| } | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
l/m: We could arguably skip all 4xxs (also 3xxs if that can ever happen).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Two optional suggestion to streamline the code but otherwise LGTM! (feel free to merge and streamline in a follow-up PR or not at all)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (errorContext) { | ||
| const structuredContext = extractErrorContext(errorContext); | ||
|
|
||
| captureException(error, { | ||
| captureContext: { contexts: { nuxt: structuredContext } }, | ||
| mechanism: { handled: false }, | ||
| }); | ||
| } else { | ||
| captureException(error, { mechanism: { handled: false } }); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
l (feel free to disregard): WDYT about calling captureException only once and setting captureContext depending on errorContext
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| tags: undefined, | ||
| }; | ||
|
|
||
| if (errorContext) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
l: do we need this guard? i.e. can CapturedErrorContext be undefined?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Preparing `@sentry/nuxt` for a release (experimental) Merge after this PR: #12796
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Add server (nitro) instrumentation
There was an error while loading. Please reload this page.