mol_plot_all 1.2.520 → 1.2.521

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mol_plot_all",
3
- "version": "1.2.520",
3
+ "version": "1.2.521",
4
4
  "exports": {
5
5
  "node": {
6
6
  "import": "./node.mjs",
package/web.test.js CHANGED
@@ -2945,6 +2945,16 @@ var $;
2945
2945
  super();
2946
2946
  this.native = native;
2947
2947
  }
2948
+ status() {
2949
+ const types = ['unknown', 'inform', 'success', 'redirect', 'wrong', 'failed'];
2950
+ return types[Math.floor(this.native.status / 100)];
2951
+ }
2952
+ code() {
2953
+ return this.native.status;
2954
+ }
2955
+ message() {
2956
+ return this.native.statusText || `HTTP Error ${this.code()}`;
2957
+ }
2948
2958
  headers() {
2949
2959
  return this.native.headers;
2950
2960
  }
@@ -3016,36 +3026,42 @@ var $;
3016
3026
  });
3017
3027
  }
3018
3028
  static response(input, init) {
3019
- const response = $mol_wire_sync(this).request(input, init);
3020
- if (Math.floor(response.status / 100) === 2)
3021
- return new $mol_fetch_response(response);
3022
- throw new Error(response.statusText || `HTTP Error ${response.status}`);
3029
+ return new $mol_fetch_response($mol_wire_sync(this).request(input, init));
3030
+ }
3031
+ static success(input, init) {
3032
+ const response = this.response(input, init);
3033
+ if (response.status() === 'success')
3034
+ return response;
3035
+ throw new Error(response.message());
3023
3036
  }
3024
3037
  static stream(input, init) {
3025
- return this.response(input, init).stream();
3038
+ return this.success(input, init).stream();
3026
3039
  }
3027
3040
  static text(input, init) {
3028
- return this.response(input, init).text();
3041
+ return this.success(input, init).text();
3029
3042
  }
3030
3043
  static json(input, init) {
3031
- return this.response(input, init).json();
3044
+ return this.success(input, init).json();
3032
3045
  }
3033
3046
  static buffer(input, init) {
3034
- return this.response(input, init).buffer();
3047
+ return this.success(input, init).buffer();
3035
3048
  }
3036
3049
  static xml(input, init) {
3037
- return this.response(input, init).xml();
3050
+ return this.success(input, init).xml();
3038
3051
  }
3039
3052
  static xhtml(input, init) {
3040
- return this.response(input, init).xhtml();
3053
+ return this.success(input, init).xhtml();
3041
3054
  }
3042
3055
  static html(input, init) {
3043
- return this.response(input, init).html();
3056
+ return this.success(input, init).html();
3044
3057
  }
3045
3058
  }
3046
3059
  __decorate([
3047
3060
  $mol_action
3048
3061
  ], $mol_fetch, "response", null);
3062
+ __decorate([
3063
+ $mol_action
3064
+ ], $mol_fetch, "success", null);
3049
3065
  __decorate([
3050
3066
  $mol_action
3051
3067
  ], $mol_fetch, "stream", null);