Skip to content

Improved error codes #1040

@dtjones404

Description

@dtjones404

Hi team,

We wanted to see if there’s any interest in reviving the functionality described in issue #871. For context, our PayPal SDK exposes onError and onCancel callbacks, which allow merchants to respond differentially to checkout failures caused by uncaught errors during the processing of a transaction, and those caused by the buyer intentionally abandoning the transaction (e.g. by closing the payment window.) Currently, this requires us to distinguish between AbortErrors based on error.message:

#handlePaymentError(
    error,
  ) {
    if (
      [
        "Request cancelled", // used by Chrome <= 76, Opera 63
        "User closed the Payment Request UI.", // Chrome 77+, Edge 79+, Opera 64+
      ].includes(
        error.message,
      )
    ) {
      this.paymentFlowOptions.onCancel?.();
    } else {
      this.paymentFlowOptions.onError?.(error);
    }
  }


This works but we’d prefer to have a solution that isn’t dependent on vendor-specific error messages which might change in the future.

Metadata

Metadata

Assignees

Labels

privacy-trackerGroup bringing to attention of Privacy, or tracked by the Privacy Group but not needing response.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions