summaryrefslogtreecommitdiff
path: root/source/github-helpers/api.ts
diff options
context:
space:
mode:
authorGravatar Kid <44045911+kidonng@users.noreply.github.com> 2021-10-04 13:21:01 +0800
committerGravatar GitHub <noreply@github.com> 2021-10-04 07:21:01 +0200
commita5f9d791337358ca2e1cc7d68c8c65fab0bca9e9 (patch)
tree061fa5c33237c0377512d983a8e4e40177fed7ce /source/github-helpers/api.ts
parent72b7e5ef059dd96a81ba6e14fe8b2bbcc4cbc9aa (diff)
downloadrefined-github-a5f9d791337358ca2e1cc7d68c8c65fab0bca9e9.tar.gz
refined-github-a5f9d791337358ca2e1cc7d68c8c65fab0bca9e9.tar.zst
refined-github-a5f9d791337358ca2e1cc7d68c8c65fab0bca9e9.zip
Meta: Improve lack of token scopes message (#4852)
Diffstat (limited to 'source/github-helpers/api.ts')
-rw-r--r--source/github-helpers/api.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/github-helpers/api.ts b/source/github-helpers/api.ts
index e9ca80af..069f0197 100644
--- a/source/github-helpers/api.ts
+++ b/source/github-helpers/api.ts
@@ -72,7 +72,7 @@ export async function expectTokenScope(scope: string): Promise<void> {
const {headers} = await v3('/');
const tokenScopes = headers.get('X-OAuth-Scopes')!;
if (!tokenScopes.split(', ').includes(scope)) {
- throw new Error(`The token you provided does not have the \`${scope}\` scope. It only includes \`${tokenScopes}\``);
+ throw new Error('The token you provided does not have ' + (tokenScopes ? `the \`${scope}\` scope. It only includes \`${tokenScopes}\`.` : 'any scope.'));
}
}