@byloth/core 2.2.8 → 2.2.9

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": "@byloth/core",
3
- "version": "2.2.8",
3
+ "version": "2.2.9",
4
4
  "description": "An unopinionated collection of useful functions and classes that I use widely in all my projects. 🔧",
5
5
  "keywords": [
6
6
  "Core",
@@ -51,14 +51,14 @@
51
51
  "devDependencies": {
52
52
  "@byloth/eslint-config-typescript": "^4.0.1",
53
53
  "@eslint/compat": "^2.1.0",
54
- "@types/node": "^24.12.3",
55
- "@vitest/coverage-v8": "^4.1.5",
54
+ "@types/node": "^24.12.4",
55
+ "@vitest/coverage-v8": "^4.1.6",
56
56
  "eslint": "^10.3.0",
57
57
  "husky": "^9.1.7",
58
58
  "jsdom": "^29.1.1",
59
59
  "typescript": "^6.0.3",
60
- "vite": "^8.0.11",
61
- "vitest": "^4.1.5"
60
+ "vite": "^8.0.12",
61
+ "vitest": "^4.1.6"
62
62
  },
63
63
  "scripts": {
64
64
  "dev": "vite",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = "2.2.8";
1
+ export const VERSION = "2.2.9";
2
2
 
3
3
  export type { Constructor, Interval, Timeout, ValueOf } from "./core/types.js";
4
4
 
@@ -251,7 +251,20 @@ export class ResponseException extends NetworkException
251
251
  */
252
252
  public constructor(response: Response, cause?: unknown, name = "ResponseException")
253
253
  {
254
- super(`The request failed with the status code ${response.status} (${response.statusText}).`, cause, name);
254
+ let message: string;
255
+
256
+ const url = response.url ? ` to "${response.url}"` : "";
257
+ const status = response.statusText ? `${response.status} (${response.statusText})` : response.status;
258
+ if (response.statusText)
259
+ {
260
+ message = `The request${url} failed with status ${status}.`;
261
+ }
262
+ else
263
+ {
264
+ message = `The request${url} failed with status ${status}.`;
265
+ }
266
+
267
+ super(message, cause, name);
255
268
 
256
269
  this.response = response;
257
270
  }