diff options
Diffstat (limited to 'source/libs/utils.ts')
-rw-r--r-- | source/libs/utils.ts | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/source/libs/utils.ts b/source/libs/utils.ts index 38d4b6b9..68ff552b 100644 --- a/source/libs/utils.ts +++ b/source/libs/utils.ts @@ -8,14 +8,16 @@ export function logError(featureName: typeof __featureName__, error: Error | str 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`, error, ...extras, stripIndent(` - - Search for open issues: - https://github.com/sindresorhus/refined-github/issues?q=is%3Aissue+${encodeURIComponent(message)} - - or open a new one: - https://github.com/sindresorhus/refined-github/issues/new?labels=bug&template=bug_report.md&title=${encodeURIComponent(`\`${featureName}\`: ${message}`)} - `)); + console.error( + `❌ Refined GitHub → ${featureName} →`, + error, + ...extras, + stripIndent(` + Search issue: https://github.com/sindresorhus/refined-github/issues?q=is%3Aissue+${encodeURIComponent(message)} + + Open an issue: https://github.com/sindresorhus/refined-github/issues/new?labels=bug&template=bug_report.md&title=${encodeURIComponent(`\`${featureName}\`: ${message}`)} + `) + ); } export const getUsername = onetime(() => select('meta[name="user-login"]')!.getAttribute('content')!); @@ -156,17 +158,6 @@ export async function poll<T>(callback: () => T, frequency: number): Promise<T> }); } -// TODO: Merge this with `logError` -export function reportBug(featureName: string, bugName: string): void { - alert(`Refined GitHub: ${bugName}. Can you report this issue? You’ll find more information in the console.`); - const issuesUrl = new URL('https://github.com/sindresorhus/refined-github/issues'); - const newIssueUrl = new URL('https://github.com/sindresorhus/refined-github/new?labels=bug&template=bug_report.md'); - issuesUrl.searchParams.set('q', `is:issue ${featureName}`); - newIssueUrl.searchParams.set('title', `\`${featureName}\` ${bugName}`); - console.log('Find existing issues:\n' + String(issuesUrl)); - console.log('Open new issue:\n' + String(newIssueUrl)); -} - /** * Prepend `:scope >` to a single or group of css selectors. * @param {string} selector A css selector. |