Re: [w3c/payment-request] fine-grained errors reporting for PaymentAddress (#712)

marcoscaceres commented on this pull request.



> @@ -2719,6 +2761,152 @@ <h2>
           </dd>
         </dl>
       </section>
+      <section data-dfn-for="AddressErrorFields" data-link-for=
+      "AddressErrorFields">
+        <h2>
+          <dfn>AddressErrorFields</dfn> dictionary
+        </h2>
+        <pre class="idl">
+          dictionary AddressErrorFields {
+            DOMString addressLineError;

depends... the problem I ran into was in destructuring and using object short hands. Also, consider the `shippingAddressErrors` can be the result of another function. Thus:

```JS
function validateAddress(address){
   // whoops, now "postalCode" has been squatted. 
   const  { postalCode } = address;
   const postalCodeError =  !isValidPostCode(postCode) ? "Invalid zip code" : undefined;
   return { postalCodeError }
}

function collectErrors(response) {
   // same problem here!
   const { shippingAddress } = response;
   const  shippingAddressErrors = validateAddress(shippingAddress);
   return { shippingAddressErrors }
}
```

And so on... 

-- 
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/pull/712#discussion_r190767588

Received on Friday, 25 May 2018 00:51:52 UTC