Ensure an output of the verification process

This commit is contained in:
Yarmo Mackenbach 2021-04-30 15:35:41 +02:00
parent e718c02628
commit 41d3b16029
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1

View file

@ -213,7 +213,7 @@ class Claim {
for (let index = 0; index < this._matches.length; index++) {
const claimData = this._matches[index]
let verificationResult,
let verificationResult = null,
proofData = null,
proofFetchError
@ -235,18 +235,18 @@ class Claim {
viaProxy: proofData.viaProxy,
}
} else {
if (this.isAmbiguous()) {
// Assume a wrong match and continue
continue
}
// Consider the proof completed but with a negative result
verificationResult = {
verificationResult = verificationResult ? verificationResult : {
result: false,
completed: true,
proof: {},
errors: [proofFetchError],
}
if (this.isAmbiguous()) {
// Assume a wrong match and continue
continue
}
}
if (verificationResult.completed) {
@ -257,6 +257,14 @@ class Claim {
}
}
// Fail safe verification result
verificationResult = verificationResult ? verificationResult : {
result: false,
completed: true,
proof: {},
errors: ['Unknown error'],
}
this._status = E.ClaimStatus.VERIFIED
}