@fluxerjs/rest 1.0.2 → 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;
@@ -129,7 +136,7 @@ var RequestManager = class {
129
136
  authPrefix: options.authPrefix ?? "Bot",
130
137
  timeout: options.timeout ?? 15e3,
131
138
  retries: options.retries ?? 3,
132
- userAgent: options.userAgent ?? "fluxer-core.js"
139
+ userAgent: options.userAgent ?? "fluxerjs"
133
140
  };
134
141
  }
135
142
  setToken(token) {
@@ -238,7 +245,7 @@ var REST = class extends import_events.EventEmitter {
238
245
  authPrefix: options.authPrefix ?? "Bot",
239
246
  timeout: options.timeout ?? 15e3,
240
247
  retries: options.retries ?? 3,
241
- userAgent: options.userAgent ?? "fluxer-core.js"
248
+ userAgent: options.userAgent ?? "fluxerjs"
242
249
  });
243
250
  }
244
251
  setToken(token) {
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;
@@ -96,7 +103,7 @@ var RequestManager = class {
96
103
  authPrefix: options.authPrefix ?? "Bot",
97
104
  timeout: options.timeout ?? 15e3,
98
105
  retries: options.retries ?? 3,
99
- userAgent: options.userAgent ?? "fluxer-core.js"
106
+ userAgent: options.userAgent ?? "fluxerjs"
100
107
  };
101
108
  }
102
109
  setToken(token) {
@@ -205,7 +212,7 @@ var REST = class extends EventEmitter {
205
212
  authPrefix: options.authPrefix ?? "Bot",
206
213
  timeout: options.timeout ?? 15e3,
207
214
  retries: options.retries ?? 3,
208
- userAgent: options.userAgent ?? "fluxer-core.js"
215
+ userAgent: options.userAgent ?? "fluxerjs"
209
216
  });
210
217
  }
211
218
  setToken(token) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.2",
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.2"
22
+ "@fluxerjs/types": "1.0.5"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^20.0.0",