diff --git a/src/claim.js b/src/claim.js index c03c0a4..558d440 100644 --- a/src/claim.js +++ b/src/claim.js @@ -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 }