diff --git a/src/background/services/openPayments.ts b/src/background/services/openPayments.ts index 9fc24ea8..53551106 100644 --- a/src/background/services/openPayments.ts +++ b/src/background/services/openPayments.ts @@ -628,7 +628,7 @@ export class OpenPaymentsService { try { await this.client!.grant.cancel(grantContinuation); } catch (error) { - if (isInvalidClientError(error)) { + if (isInvalidClientError(error) || isInvalidContinuationError(error)) { // key already removed from wallet return; } @@ -787,6 +787,11 @@ export const isInvalidClientError = (error: any) => { return error.status === 400 && error.code === 'invalid_client'; }; +export const isInvalidContinuationError = (error: any) => { + if (!isOpenPaymentsClientError(error)) return false; + return error.status === 401 && error.code === 'invalid_continuation'; +}; + // RESOURCE SERVER error. Create outgoing payment and create quote can fail // with: `Signature validation error: could not find key in list of client keys` export const isSignatureValidationError = (error: any) => {