Closed rsolomakhin closed 4 years ago
Suggestion originally from @noncombatant
We've generally moved away from error codes like the above in the web platform... "Legacy code name and value" where there are now gaps: https://heycam.github.io/webidl/#idl-DOMException-error-names
We generally don't want to distinguish too much between how browsers behave and exposing user actions.... like, the tab switching behavior where the payment sheet closes might be Chrome specific behavior, but not necessarily something another browser does (e.g., I might switch to my bank's site to check if I have enough money in my bank account before I make a purchase... on Firefox, I would expect the payment sheet to still be there and the site not to know that I'm doing something else).
Having said that, we could review the errors we are throwing and see if we can be more specific... distinguishing between developer error and user (agent) aborts would be good, but I would caution going beyond that.
@marcoscaceres : If we want to use existing DOMException error names, then error cases 3 and 4 could reject show()
with OperationError
instead of AbortError
. WDYT?
I think that would be ok... alternatively, we throw just a general TypeError
, which I think it's more common nowadays for data errors.
Might be worth throwing up a PR with the proposed changes and where you think we should change.
@rsolomakhin, should we still do this?
Let's put this in the ice box and possibly re-open in the future if the need arises.
Four separate categories of error states return
AbortError
with vendor-specific error messages. Each of these categories requires a separate response from the merchant.paymentrequest
event. Merchants may want to provide a fallback checkout experience, e.g., autofill form fields for credit card input. Merchants may want to let the payment app provider know about a bug in their code.Chrome returns different message strings with these categories of messages, but requiring the merchant to distinguish errors by message strings is brittle and flaky. I propose that PR 1.1+ should standardize some error codes that the browser should return when rejecting
PaymentRequest.show()
. For example:Error messages themselves can remain vendor specific, as long as they follow the format: