@dunx/http 3.0.4 → 3.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.
|
@@ -98,7 +98,7 @@ class HttpError extends AppError {
|
|
|
98
98
|
this.headers = options?.headers;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
Object.defineProperty(HttpError, Symbol.for("dunx.deps"), { value: () => [{ unresolved: "readonly status: number" }, { unresolved: "message: string" }, { unresolved: "options?: HttpErrorOptions" }] });
|
|
101
|
+
Object.defineProperty(HttpError, Symbol.for("dunx.deps"), { value: () => [{ unresolved: "override readonly status: number" }, { unresolved: "message: string" }, { unresolved: "options?: HttpErrorOptions" }] });
|
|
102
102
|
|
|
103
103
|
class ValidationError extends HttpError {
|
|
104
104
|
source;
|
|
@@ -129,12 +129,19 @@ var errorMapper = (logger) => (error) => {
|
|
|
129
129
|
...error.headers && { headers: error.headers }
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
+
if (error instanceof AppError && isStatus(error.status)) {
|
|
133
|
+
if (error.status >= HttpStatusCode.INTERNAL_SERVER_ERROR) {
|
|
134
|
+
logger.error("Unhandled error", error);
|
|
135
|
+
}
|
|
136
|
+
return Response.json({ error: error.message, status: error.status }, { status: error.status });
|
|
137
|
+
}
|
|
132
138
|
logger.error("Unhandled error", error);
|
|
133
139
|
return Response.json({
|
|
134
140
|
error: "Internal Server Error",
|
|
135
141
|
status: HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
136
142
|
}, { status: HttpStatusCode.INTERNAL_SERVER_ERROR });
|
|
137
143
|
};
|
|
144
|
+
var isStatus = (value) => value !== undefined && Number.isInteger(value) && value >= 200 && value <= 599;
|
|
138
145
|
var defaultErrorMapper = errorMapper(new ConsoleLogger);
|
|
139
146
|
|
|
140
147
|
// src/route/discover.ts
|
|
@@ -20,7 +20,7 @@ class FetchError extends AppError {
|
|
|
20
20
|
this.response = response;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
Object.defineProperty(FetchError, Symbol.for("dunx.deps"), { value: () => [{ unresolved: "readonly status: number" }, { unresolved: "readonly statusText: string" }, { unresolved: "readonly body: unknown" }, { unresolved: `readonly response: {
|
|
23
|
+
Object.defineProperty(FetchError, Symbol.for("dunx.deps"), { value: () => [{ unresolved: "override readonly status: number" }, { unresolved: "readonly statusText: string" }, { unresolved: "readonly body: unknown" }, { unresolved: `readonly response: {
|
|
24
24
|
readonly method: string;
|
|
25
25
|
readonly url: string;
|
|
26
26
|
readonly headers: Headers;
|
package/dist/client.js
CHANGED
package/dist/index.js
CHANGED
package/dist/internal.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
toErrorMapper,
|
|
37
37
|
withCors,
|
|
38
38
|
withUpgradeRoutes
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-3xs8zrpv.js";
|
|
40
40
|
import {
|
|
41
41
|
backoffDelay,
|
|
42
42
|
executeWithRetry,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
isRetryableStatus,
|
|
46
46
|
retryAfterMs,
|
|
47
47
|
safeStringify
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-7xrtwbx3.js";
|
|
49
49
|
import"./chunk-sz4pvqxy.js";
|
|
50
50
|
// src/inspect.ts
|
|
51
51
|
import {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dunx/http",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "Bun.serve adapter for the dunx framework: controllers, middleware and WebSocket gateways",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@dunx/core": "workspace:*"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@dunx/core": "^3.0.
|
|
65
|
+
"@dunx/core": "^3.0.5",
|
|
66
66
|
"@types/bun": ">=1.3.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependenciesMeta": {
|