fix: handle manual bug reports by modifying error structure in submitErrorReport

This commit is contained in:
Mo Tarbin
2026-08-16 01:07:55 -04:00
parent 77834aa3c0
commit 5c71e4ce58

View File

@@ -249,13 +249,28 @@ export const submitErrorReport = async ({
description, description,
report, report,
}) => { }) => {
// The relay rejects reports without an error. Manual bug reports have no
// thrown Error, so mark only the submitted copy while preserving the local
// diagnostics as a manual report.
const submittedReport =
report.kind === 'bug'
? {
...report,
error: {
...report.error,
name: 'ManualBugReport',
message: 'Submitted manually from the app',
},
}
: report
const payload = { const payload = {
source: 'donetick-app', source: 'donetick-app',
kind: report.kind === 'bug' ? 'bug-report' : 'error-report', kind: 'error-report',
reportId: report.reportId, reportId: report.reportId,
description: description?.trim() || null, description: description?.trim() || null,
contactEmail: contactEmail?.trim() || null, contactEmail: contactEmail?.trim() || null,
report, report: submittedReport,
} }
// Enforced here, not only in the UI, so no future caller can relay a // Enforced here, not only in the UI, so no future caller can relay a