Re: [w3c/payment-request] fine grained error recovery for fields (#647)

Here is an implementation showing how it could work with `.retry(...errors)` . 

```JS
async function doPaymentRequest() {
  const request = new PaymentRequest(methods, details, options);
  const response = await request.show();
  try {
    await retryUntilGood(response);
    const status = await processPayment(response);
    await response.complete(status);
  } catch (err) { 
    // AbortError? user got bored retrying. 
  }
}

async function retryUntilGood(response) {
  const errors = await validateResponse(response);
  if (errors.length) {
    await response.retry(...errors); // Can throw AbortError
    await validateAndRetry(response);
  }
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-request/issues/647#issuecomment-349868456

Received on Thursday, 7 December 2017 05:38:06 UTC