Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix don't report expected voyager crashes to sentry #421

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions lib/zinnia.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,18 +260,22 @@ const catchChildProcessExit = async ({
const moduleName = capitalize(err.moduleName ?? 'Zinnia')
const exitReason = err.exitReason ?? 'for unknown reason'
const message = `${moduleName} crashed ${exitReason}`
const type = err.moduleName === 'voyager' ? 'info' : 'error'
const isCritical = err.moduleName !== 'voyager'
const type = isCritical ? 'error' : 'info'
onActivity({ type, message })
const moduleErr = new Error(message, { cause: err })
// Store the full error message including stdout & stder in the top-level `details` property
Object.assign(moduleErr, { details: err.message })

// Apply a custom rule to force Sentry to group all issues with the same module & exit code
// See https://docs.sentry.io/platforms/node/usage/sdk-fingerprinting/#basic-example
Sentry.withScope(scope => {
scope.setFingerprint([message])
maybeReportErrorToSentry(moduleErr)
})

if (isCritical) {
const moduleErr = new Error(message, { cause: err })
// Store the full error message including stdout & stder in the top-level `details` property
Object.assign(moduleErr, { details: err.message })

// Apply a custom rule to force Sentry to group all issues with the same module & exit code
// See https://docs.sentry.io/platforms/node/usage/sdk-fingerprinting/#basic-example
Sentry.withScope(scope => {
scope.setFingerprint([message])
maybeReportErrorToSentry(moduleErr)
})
}
throw err
}
} finally {
Expand Down