summaryrefslogtreecommitdiff
path: root/source/libs/utils.ts
diff options
context:
space:
mode:
authorGravatar Federico Brigante <opensource@bfred.it> 2020-02-02 16:31:24 +0700
committerGravatar Federico Brigante <opensource@bfred.it> 2020-02-04 15:14:03 +0700
commitbac196b114a751f86089ba4bcc4269bb20d6da49 (patch)
tree7cad9a9e2ee9f7ad733412460591b19dfcf774eb /source/libs/utils.ts
parenta367b56ec0449e2fb5caac6969ed74224df321ad (diff)
downloadrefined-github-bac196b114a751f86089ba4bcc4269bb20d6da49.tar.gz
refined-github-bac196b114a751f86089ba4bcc4269bb20d6da49.tar.zst
refined-github-bac196b114a751f86089ba4bcc4269bb20d6da49.zip
Meta: improve error reporting
Diffstat (limited to 'source/libs/utils.ts')
-rw-r--r--source/libs/utils.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/libs/utils.ts b/source/libs/utils.ts
index b8efa1b6..e5047015 100644
--- a/source/libs/utils.ts
+++ b/source/libs/utils.ts
@@ -3,10 +3,11 @@ import onetime from 'onetime';
import stripIndent from 'strip-indent';
import {isRepo, isPR, isIssue} from './page-detect';
-export function logError(featureName: typeof __featureName__, message: string, ...extras: unknown[]): void {
+export function logError(featureName: typeof __featureName__, error: Error | string, ...extras: unknown[]): void {
+ const message = typeof error === 'string' ? error : error.message;
// Don't change this to `throw Error` because Firefox doesn't show extensions' errors in the console.
// Use `return` after calling this function.
- console.error(`❌ Refined GitHub: feature \`${featureName}\`\n\n${message}`, ...extras, stripIndent(`
+ console.error(`❌ Refined GitHub: feature \`${featureName}\`\n\n`, error, ...extras, stripIndent(`
Search for open issues:
https://github.com/sindresorhus/refined-github/issues?q=is%3Aissue+${encodeURIComponent(message)}