@teardown/errors 0.1.41 → 0.1.44
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 +3 -3
- package/src/index.ts +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teardown/errors",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.44",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@biomejs/biome": "2.3.8",
|
|
34
|
-
"@teardown/tsconfig": "0.1.
|
|
35
|
-
"@types/bun": "1.3.
|
|
34
|
+
"@teardown/tsconfig": "0.1.44",
|
|
35
|
+
"@types/bun": "1.3.4"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"typescript": "5.9.3",
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Elysia,
|
|
1
|
+
import { Elysia, ValidationError } from "elysia";
|
|
2
2
|
import { ZodError } from "zod";
|
|
3
3
|
|
|
4
4
|
export enum ErrorCodes {
|
|
@@ -278,6 +278,13 @@ export const ElysiaErrors = new Elysia()
|
|
|
278
278
|
SERVICE_UNAVAILABLE: InternalServerError,
|
|
279
279
|
})
|
|
280
280
|
.onError(({ error, code, set }) => {
|
|
281
|
+
// Skip logging validation errors - they're expected and properly handled by Elysia
|
|
282
|
+
if (error instanceof ValidationError || code === "VALIDATION") {
|
|
283
|
+
const result = handleError(error, code);
|
|
284
|
+
set.status = result.status;
|
|
285
|
+
return result.body;
|
|
286
|
+
}
|
|
287
|
+
|
|
281
288
|
console.error("[ErrorHandler] Unhandled error:", {
|
|
282
289
|
code,
|
|
283
290
|
error,
|