Re: [w3c/browser-payment-api] Reject acceptedPromise if converting method data fails (#536)

adrianhopebailie commented on this pull request.



> -              <a>payment method identifiers</a> given <var>identifiers</var>.
-              For each resulting payment handler, if payment method specific
-              capabilities supplied by the payment handler match those provided
-              by <var>data</var>, the payment handler matches.
+              <li>Let <var>data</var> be the result of <a data-cite=
+              "!ECMA-262-2015#sec-json.parse">JSON-parsing</a> the second
+              element in <var>paymentMethod</var> tuple.
+              </li>
+              <li>If required by the specification that defines the
+              <var>identifer</var>, then <a data-cite=
+              "!WEBIDL#dfn-convert-ecmascript-to-idl-value">convert</a>
+              <var>data</var> to an IDL value. Otherwise, <a data-cite=
+              "!WEBIDL#dfn-convert-ecmascript-to-idl-value">convert</a> to
+              <a data-cite="!WEBIDL#idl-object">object</a>.
+              </li>
+              <li>If conversion results in an error, reject

Isn't the intent here to discard this tuple and continue (possibly logging an error in the process)?

i.e. Rejecting the promise and terminating the algorithm results in no matched payment handlers, even if there are multiple `(identifer, data)` tuples and only one has invalid data.

Is it possible to throw and not reject the promise so that the browser can log the error and continue the next iteration of the loop?

If so, I propose the following, or something similar:

```
<li>If conversion results in an error, discard
 the <var>paymentMethod</var> tuple, throw the error and process 
the next tuple.</li>
```

-- 
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/browser-payment-api/pull/536#pullrequestreview-45637129

Received on Thursday, 22 June 2017 07:17:13 UTC