@orpc/contract 0.33.0 → 0.35.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/index.js +7 -0
- package/dist/src/error-utils.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -319,6 +319,12 @@ async function validateORPCError(map, error) {
|
|
|
319
319
|
}
|
|
320
320
|
return new ORPCError(code, { defined: true, status, message, data: validated.value, cause });
|
|
321
321
|
}
|
|
322
|
+
function toORPCError(error) {
|
|
323
|
+
return error instanceof ORPCError ? error : new ORPCError("INTERNAL_SERVER_ERROR", {
|
|
324
|
+
message: "Internal server error",
|
|
325
|
+
cause: error
|
|
326
|
+
});
|
|
327
|
+
}
|
|
322
328
|
|
|
323
329
|
// src/client-utils.ts
|
|
324
330
|
async function safe(promise) {
|
|
@@ -395,6 +401,7 @@ export {
|
|
|
395
401
|
oc,
|
|
396
402
|
prefixRoute,
|
|
397
403
|
safe,
|
|
404
|
+
toORPCError,
|
|
398
405
|
type,
|
|
399
406
|
unshiftTagRoute,
|
|
400
407
|
validateORPCError
|
|
@@ -11,4 +11,5 @@ export type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
|
|
13
13
|
export declare function validateORPCError(map: ErrorMap, error: ORPCError<any, any>): Promise<ORPCError<string, unknown>>;
|
|
14
|
+
export declare function toORPCError(error: unknown): ORPCError<any, any>;
|
|
14
15
|
//# sourceMappingURL=error-utils.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/contract",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.35.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@standard-schema/spec": "1.0.0-rc.0",
|
|
33
|
-
"@orpc/shared": "0.
|
|
33
|
+
"@orpc/shared": "0.35.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"arktype": "2.0.0-rc.26",
|