Add ability for users to send error reports (#10427)

This commit is contained in:
Eric Bailey
2026-05-05 17:21:42 -05:00
committed by GitHub
parent 9bf06a80a5
commit 8e06c9fbb7
5 changed files with 157 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import slugify from 'slugify'
import {getEntries} from '#/logger/logDump'
import {Sentry} from '#/logger/sentry/lib'
export function sendErrorReport({
title,
description,
handle,
}: {
title: string
description: string
handle: string
}) {
const name = slugify(title, {lower: true, strict: true}).slice(0, 32)
Sentry.withScope(scope => {
scope.addAttachment({
filename: name + '.json',
data: JSON.stringify(getEntries()),
contentType: 'application/json',
// mimetype: 'application/json', // need to update Sentry
})
scope.setExtras({
title,
description,
handle,
})
scope.captureMessage(`[USER REPORT] ${handle} ${name}`, 'error')
})
}