@fluxerjs/rest 1.0.4 → 1.0.5

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.js CHANGED
@@ -105,11 +105,18 @@ var RateLimitError = class _RateLimitError extends FluxerAPIError {
105
105
  };
106
106
 
107
107
  // src/errors/HTTPError.ts
108
+ var STATUS_MESSAGES = {
109
+ 502: "Bad Gateway \u2014 Fluxer API may be temporarily unavailable.",
110
+ 503: "Service Unavailable \u2014 Fluxer API is down or overloaded. Try again later.",
111
+ 504: "Gateway Timeout \u2014 Fluxer API did not respond in time."
112
+ };
108
113
  var HTTPError = class _HTTPError extends Error {
109
114
  statusCode;
110
115
  body;
111
116
  constructor(statusCode, body) {
112
- super(`HTTP ${statusCode}: ${body ?? "No body"}`);
117
+ const hint = STATUS_MESSAGES[statusCode];
118
+ const detail = body?.trim() || (hint ?? "No body");
119
+ super(`HTTP ${statusCode}: ${detail}`);
113
120
  this.name = "HTTPError";
114
121
  this.statusCode = statusCode;
115
122
  this.body = body;
package/dist/index.mjs CHANGED
@@ -72,11 +72,18 @@ var RateLimitError = class _RateLimitError extends FluxerAPIError {
72
72
  };
73
73
 
74
74
  // src/errors/HTTPError.ts
75
+ var STATUS_MESSAGES = {
76
+ 502: "Bad Gateway \u2014 Fluxer API may be temporarily unavailable.",
77
+ 503: "Service Unavailable \u2014 Fluxer API is down or overloaded. Try again later.",
78
+ 504: "Gateway Timeout \u2014 Fluxer API did not respond in time."
79
+ };
75
80
  var HTTPError = class _HTTPError extends Error {
76
81
  statusCode;
77
82
  body;
78
83
  constructor(statusCode, body) {
79
- super(`HTTP ${statusCode}: ${body ?? "No body"}`);
84
+ const hint = STATUS_MESSAGES[statusCode];
85
+ const detail = body?.trim() || (hint ?? "No body");
86
+ super(`HTTP ${statusCode}: ${detail}`);
80
87
  this.name = "HTTPError";
81
88
  this.statusCode = statusCode;
82
89
  this.body = body;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.4",
6
+ "version": "1.0.5",
7
7
  "description": "REST client for the Fluxer API",
8
8
  "main": "./dist/index.js",
9
9
  "module": "./dist/index.mjs",
@@ -19,7 +19,7 @@
19
19
  "dist"
20
20
  ],
21
21
  "dependencies": {
22
- "@fluxerjs/types": "1.0.4"
22
+ "@fluxerjs/types": "1.0.5"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^20.0.0",