From 8fe047b69e713f35272f0537881b7a9671398032 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Wed, 12 Jun 2024 01:19:55 +0200 Subject: [PATCH] docs: link to faq if known error we have the same errors reported over and over again and there is FAQ for them. this ensures these errors are not reported anymore, but user is routed to FAQ entry instead, to self-service --- src/dialogs/errors.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/dialogs/errors.js b/src/dialogs/errors.js index da0a56d24..3ba56b27e 100644 --- a/src/dialogs/errors.js +++ b/src/dialogs/errors.js @@ -28,7 +28,20 @@ ${e.stack} let hasErrored = false -const generateErrorIssueUrl = (e) => `https://github.com/ipfs-shipyard/ipfs-desktop/issues/new?labels=kind%2Fbug%2C+need%2Ftriage&template=bug_report.md&title=${encodeURI(issueTitle(e))}&body=${encodeURI(issueTemplate(e))}`.substring(0, 1999) +function generateErrorIssueUrl (e) { + // Check if error is one we have FAQ for + if (e && e.stack) { + const stack = e.stack + switch (true) { + case stack.includes('repo.lock'): + return 'https://github.com/ipfs/ipfs-desktop?tab=readme-ov-file#i-got-a-repolock-error-how-do-i-resolve-this' + case stack.includes('Error fetching'): + return 'https://github.com/ipfs/ipfs-desktop?tab=readme-ov-file#i-got-a-network-error-eg-error-fetching-what-should-i-do' + } + } + // Something else, prefill new issue form with error details + return `https://github.com/ipfs/ipfs-desktop/issues/new?labels=kind%2Fbug%2C+need%2Ftriage&template=bug_report.md&title=${encodeURI(issueTitle(e))}&body=${encodeURI(issueTemplate(e))}`.substring(0, 1999) +} /** * This will fail and throw another application error if electron hasn't booted up properly.