From 83a57609594147b2ba37460339f1487a4906abce Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Fri, 7 Aug 2026 20:25:06 -0400 Subject: [PATCH] Enhance error reporting functionality: add bug report option in settings, update error report modal, and refine feedback descriptions --- public/locales/en/settings.json | 6 ++++- src/service/ErrorReportService.js | 24 +++++++++++++------ src/views/Modals/ErrorReportModal.jsx | 32 ++++++++++++++++++------- src/views/Settings/SettingsOverview.jsx | 18 ++++++++++++++ 4 files changed, 64 insertions(+), 16 deletions(-) diff --git a/public/locales/en/settings.json b/public/locales/en/settings.json index 085ef01..4edd311 100644 --- a/public/locales/en/settings.json +++ b/public/locales/en/settings.json @@ -171,7 +171,11 @@ }, "feedback": { "title": "Send Feedback", - "description": "Tell us how Donetick is working for you, report a bug, or request a feature." + "description": "Tell us how Donetick is working for you or request a feature." + }, + "bugReport": { + "title": "Report a Bug", + "description": "Something not working right? Send us the details along with a technical snapshot." } } } diff --git a/src/service/ErrorReportService.js b/src/service/ErrorReportService.js index c290c52..1d9689c 100644 --- a/src/service/ErrorReportService.js +++ b/src/service/ErrorReportService.js @@ -113,6 +113,9 @@ export const collectErrorReport = async ({ error, errorInfo, reportId }) => { return { reportId: reportId ?? newReportId(), occurredAt: new Date().toISOString(), + // No error means the user came here deliberately from settings rather than + // off the back of a crash — same diagnostics, different story to tell. + kind: error ? 'crash' : 'bug', error: describeError(error, errorInfo), runtime: describeRuntime(), app: context, @@ -137,7 +140,11 @@ export const formatErrorReport = report => { `Report ID: ${report.reportId}`, `Time: ${report.occurredAt}`, '', - `Error: ${error.name}${error.message ? `: ${error.message}` : ''}`, + // A user-initiated report has no throw behind it; "Error: Unknown" would + // only be noise in the panel the user is being asked to read. + report.kind === 'bug' + ? 'Reported manually (no crash)' + : `Error: ${error.name}${error.message ? `: ${error.message}` : ''}`, error.status ? `HTTP: ${error.status} ${error.statusText ?? ''}`.trim() : null, @@ -210,11 +217,14 @@ export const formatErrorReport = report => { * leaves infrastructure they control, and they see it before it is published. */ export const buildErrorIssueUrl = ({ description, report }) => { - const title = `[crash] ${ - report.error.message?.slice(0, 80) || - report.error.name || - 'Unexpected error' - }` + const isBug = report.kind === 'bug' + const title = isBug + ? `[bug] ${description?.trim().slice(0, 80) || 'Reported from the app'}` + : `[crash] ${ + report.error.message?.slice(0, 80) || + report.error.name || + 'Unexpected error' + }` const body = [ '### What happened', description?.trim() || '_no description provided_', @@ -241,7 +251,7 @@ export const submitErrorReport = async ({ }) => { const payload = { source: 'donetick-app', - kind: 'error-report', + kind: report.kind === 'bug' ? 'bug-report' : 'error-report', reportId: report.reportId, description: description?.trim() || null, contactEmail: contactEmail?.trim() || null, diff --git a/src/views/Modals/ErrorReportModal.jsx b/src/views/Modals/ErrorReportModal.jsx index fd3c9a0..be4d41b 100644 --- a/src/views/Modals/ErrorReportModal.jsx +++ b/src/views/Modals/ErrorReportModal.jsx @@ -100,9 +100,13 @@ const IconHalo = ({ color = 'primary', icon }) => ( * user, everything else gathered automatically. The diagnostics are shown * before sending rather than after — people are more willing to send a report * they can see, and this is the one moment they already distrust the app. + * + * Also reached deliberately from settings with no error attached, where the + * same diagnostics back a bug the user noticed but the app never threw on. */ const ErrorReportModal = ({ error, errorInfo, onClose, open }) => { const { ResponsiveModal } = useResponsiveModal() + const isBugReport = !error const [report, setReport] = useState(null) const [description, setDescription] = useState('') @@ -160,7 +164,10 @@ const ErrorReportModal = ({ error, errorInfo, onClose, open }) => { {step === STEP.FORM && ( - } color='danger' /> + } + color={isBugReport ? 'warning' : 'danger'} + /> @@ -168,26 +175,33 @@ const ErrorReportModal = ({ error, errorInfo, onClose, open }) => { level='h4' sx={{ fontWeight: 700, letterSpacing: '-0.01em' }} > - Report this problem + {isBugReport ? 'Report a bug' : 'Report this problem'} - A sentence about what you were doing turns this into something we - can actually fix. + {isBugReport + ? 'Tell us what went wrong and we’ll attach the technical details for you.' + : 'A sentence about what you were doing turns this into something we can actually fix.'} - What were you doing? + + {isBugReport ? 'What went wrong?' : 'What were you doing?'} +