@stacksjs/error-handling 0.66.0 → 0.68.0
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/handler.d.ts +85 -12
- package/dist/http.d.ts +5 -3
- package/dist/index.d.ts +16 -4
- package/dist/index.js +34 -37
- package/dist/utils.d.ts +1 -4
- package/package.json +9 -10
- package/dist/index.js.map +0 -93
- package/src/handler.ts +0 -148
- package/src/http.ts +0 -6
- package/src/index.ts +0 -16
- package/src/utils.ts +0 -26
- package/src/views/500.html +0 -37
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export declare function rescue<
|
|
2
|
-
T,
|
|
3
|
-
F
|
|
4
|
-
>(fn: () => T | Promise<T>, fallback: F, onError?: (error: Error) => void): T | F | Promise<T | F>;
|
|
1
|
+
export declare function rescue<T, F>(fn: () => T | Promise<T>, fallback: F, onError?: (error: Error) => void,): T | F | Promise<T | F> { try { const result = fn() if (result instanceof Promise) { return result.catch((error) => { if (onError) { onError(ErrorHandler.handle(error)) } return fallback }) } return result }} catch (error) { if (onError) { onError(ErrorHandler.handle(error)) } return fallback }} };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/error-handling",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.68.0",
|
|
5
5
|
"description": "Type safe error handling.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": ["Chris Breuer <chris@stacksjs.org>"],
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"keywords": ["errors", "error-handling", "neverthrow", "type safe", "stacks"],
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"bun": "./src/index.ts",
|
|
23
22
|
"import": "./dist/index.js"
|
|
24
23
|
},
|
|
25
24
|
"./*": {
|
|
@@ -28,19 +27,19 @@
|
|
|
28
27
|
},
|
|
29
28
|
"module": "dist/index.js",
|
|
30
29
|
"types": "dist/index.d.ts",
|
|
31
|
-
"files": ["README.md", "dist"
|
|
30
|
+
"files": ["README.md", "dist"],
|
|
32
31
|
"scripts": {
|
|
33
32
|
"build": "bun build.ts",
|
|
34
33
|
"typecheck": "bun tsc --noEmit",
|
|
35
34
|
"prepublishOnly": "bun run build"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
|
-
"@stacksjs/cli": "0.
|
|
39
|
-
"@stacksjs/config": "0.
|
|
40
|
-
"@stacksjs/development": "0.
|
|
41
|
-
"@stacksjs/path": "0.
|
|
42
|
-
"@stacksjs/types": "0.
|
|
43
|
-
"@stacksjs/validation": "0.
|
|
44
|
-
"neverthrow": "^8.
|
|
37
|
+
"@stacksjs/cli": "0.67.0",
|
|
38
|
+
"@stacksjs/config": "0.67.0",
|
|
39
|
+
"@stacksjs/development": "0.67.0",
|
|
40
|
+
"@stacksjs/path": "0.67.0",
|
|
41
|
+
"@stacksjs/types": "0.67.0",
|
|
42
|
+
"@stacksjs/validation": "0.67.0",
|
|
43
|
+
"neverthrow": "^8.1.1"
|
|
45
44
|
}
|
|
46
45
|
}
|