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
async embed() {
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
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
console.debug(`metrics/compute/${login}/plugins > habits > searching recently used languages using linguist`)
if (patches.length) {

View File

@@ -47,13 +47,18 @@ export default async function({login, imports, data, q, account}, {enabled = fal
}
//Handle errors
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
if (description) {
const status = error.response?.status
return `API error: ${status} (${description})`
}
return null
}}})
},
},
})
}
}

View File

@@ -66,10 +66,14 @@ export default async function({login, data, imports, graphql, q, queries, accoun
}
//Handle errors
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"))
return "Insufficient token scopes"
return null
}}})
},
},
})
}
}