fix(plugins/traffic): warn rejected requests
This commit is contained in:
@@ -20,11 +20,15 @@ export default async function({login, imports, data, rest, q, account}, {enabled
|
||||
const response = promised.filter(({status}) => status === "fulfilled").map(({value}) => value)
|
||||
|
||||
//Handle error if all promises were rejected
|
||||
if (promised.filter(({status}) => status === "rejected").length === promised.length) {
|
||||
const rejected = promised.filter(({status}) => status === "rejected")
|
||||
if (rejected.length === promised.length) {
|
||||
if (promised.map(({reason}) => reason.message).every(error => /must have push access to repository/i.test(error)))
|
||||
throw {error: {message: "Insufficient token scopes"}}
|
||||
throw new Error(promised[0].reason.message)
|
||||
}
|
||||
else if (rejected.length) {
|
||||
rejected.map(({reason}) => console.debug(`metrics/compute/${login}/plugins > traffic > warn > ${reason.message}`))
|
||||
}
|
||||
|
||||
//Compute views
|
||||
console.debug(`metrics/compute/${login}/plugins > traffic > computing stats`)
|
||||
|
||||
Reference in New Issue
Block a user