@paynext/sdk 0.0.133 → 0.0.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -5792,7 +5792,7 @@ class G1 {
5792
5792
  status_reason: {
5793
5793
  advice_code: null,
5794
5794
  decline_code: null,
5795
- message: `${c}: ${a.message || a}}`
5795
+ message: `${c}: ${this.stringifyError(a)}`
5796
5796
  }
5797
5797
  });
5798
5798
  }
@@ -5840,6 +5840,17 @@ class G1 {
5840
5840
  setLoading(e) {
5841
5841
  this.isLoading = e, this.form.setLoading(e), this.loader.setClassName(!e || this.isFormOpen ? Qe.hidden : "");
5842
5842
  }
5843
+ // stringifies any kind of error into a readable message
5844
+ stringifyError(e) {
5845
+ if (!e) return "Unknown error";
5846
+ if (typeof e == "string") return e;
5847
+ if (e instanceof Error) return e.message || e.name;
5848
+ try {
5849
+ return JSON.stringify(e);
5850
+ } catch (n) {
5851
+ return String(e);
5852
+ }
5853
+ }
5843
5854
  // render
5844
5855
  render() {
5845
5856
  return this.checkout;