chore: code formatting

This commit is contained in:
github-actions[bot]
2022-07-07 03:42:46 +00:00
parent 33a2f43c59
commit 947d45559b
18 changed files with 44 additions and 35 deletions

View File

@@ -74,7 +74,7 @@
//Metrics embed //Metrics embed
async embed() { async embed() {
window.location.href = `/embed?user=${this.user2}` window.location.href = `/embed?user=${this.user2}`
} },
} },
}) })
})() })()

View File

@@ -97,7 +97,7 @@ export default async function({login, data, rest, imports, q, account}, {enabled
} }
//Linguist //Linguist
if ((charts)&&((imports.metadata.plugins.habits.extras("charts", {extras, error:false})))) { if ((charts) && (imports.metadata.plugins.habits.extras("charts", {extras, error: false}))) {
//Check if linguist exists //Check if linguist exists
console.debug(`metrics/compute/${login}/plugins > habits > searching recently used languages using linguist`) console.debug(`metrics/compute/${login}/plugins > habits > searching recently used languages using linguist`)
if (patches.length) { if (patches.length) {

View File

@@ -47,13 +47,18 @@ export default async function({login, imports, data, q, account}, {enabled = fal
} }
//Handle errors //Handle errors
catch (error) { catch (error) {
throw imports.format.error(error, {descriptions:{"429":'(consider using "plugin_pagespeed_token")', custom(error) { throw imports.format.error(error, {
descriptions: {
"429": '(consider using "plugin_pagespeed_token")',
custom(error) {
const description = error.response?.data?.error?.message?.match(/Lighthouse returned error: (?<description>[A-Z_]+)/)?.groups?.description ?? null const description = error.response?.data?.error?.message?.match(/Lighthouse returned error: (?<description>[A-Z_]+)/)?.groups?.description ?? null
if (description) { if (description) {
const status = error.response?.status const status = error.response?.status
return `API error: ${status} (${description})` return `API error: ${status} (${description})`
} }
return null return null
}}}) },
},
})
} }
} }

View File

@@ -66,10 +66,14 @@ export default async function({login, data, imports, graphql, q, queries, accoun
} }
//Handle errors //Handle errors
catch (error) { catch (error) {
throw imports.format.error(error, {descriptions:{custom(error) { throw imports.format.error(error, {
descriptions: {
custom(error) {
if (error.errors?.map(({type}) => type)?.includes("INSUFFICIENT_SCOPES")) if (error.errors?.map(({type}) => type)?.includes("INSUFFICIENT_SCOPES"))
return "Insufficient token scopes" return "Insufficient token scopes"
return null return null
}}}) },
},
})
} }
} }