mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49:28 -07:00
Return obj with error message instead of undefined
This commit is contained in:
parent
686f0e2a5e
commit
a1ff96a1b9
1 changed files with 13 additions and 5 deletions
|
@ -124,7 +124,11 @@ const verify = async (input, fingerprint, opts) => {
|
||||||
|
|
||||||
return Promise.allSettled(promises).then((values) => {
|
return Promise.allSettled(promises).then((values) => {
|
||||||
return values.map((obj, i) => {
|
return values.map((obj, i) => {
|
||||||
return obj.value
|
if (obj.status == 'fulfilled') {
|
||||||
|
return obj.value
|
||||||
|
} else {
|
||||||
|
return obj.reason
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -142,7 +146,11 @@ const verify = async (input, fingerprint, opts) => {
|
||||||
|
|
||||||
return Promise.allSettled(promises).then((values) => {
|
return Promise.allSettled(promises).then((values) => {
|
||||||
return values.map((obj, i) => {
|
return values.map((obj, i) => {
|
||||||
return obj.value
|
if (obj.status == 'fulfilled') {
|
||||||
|
return obj.value
|
||||||
|
} else {
|
||||||
|
return obj.reason
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -266,9 +274,9 @@ const verify = async (input, fingerprint, opts) => {
|
||||||
|
|
||||||
const promiseTimeout = new Promise((res) => {
|
const promiseTimeout = new Promise((res) => {
|
||||||
const objResult = {
|
const objResult = {
|
||||||
isVerified: null,
|
isVerified: false,
|
||||||
errors: 'verification_timed_out',
|
errors: ['verification_timed_out'],
|
||||||
serviceproviderData: null,
|
serviceproviderData: undefined,
|
||||||
}
|
}
|
||||||
setTimeout(() => res(objResult), 5000)
|
setTimeout(() => res(objResult), 5000)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue