Return obj with error message instead of undefined

This commit is contained in:
Yarmo Mackenbach 2020-12-20 22:55:08 +01:00
parent 686f0e2a5e
commit a1ff96a1b9

View file

@ -124,7 +124,11 @@ const verify = async (input, fingerprint, opts) => {
return Promise.allSettled(promises).then((values) => {
return values.map((obj, i) => {
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 values.map((obj, i) => {
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 objResult = {
isVerified: null,
errors: 'verification_timed_out',
serviceproviderData: null,
isVerified: false,
errors: ['verification_timed_out'],
serviceproviderData: undefined,
}
setTimeout(() => res(objResult), 5000)
})