@seam-rpc/server 4.3.12 → 4.3.14
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 +16 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64,6 +64,7 @@ export class SeamRouter {
|
|
|
64
64
|
input = await this.runMiddleware(req, res);
|
|
65
65
|
}
|
|
66
66
|
catch (err) {
|
|
67
|
+
console.error(err);
|
|
67
68
|
return res.status(415).send(String(err));
|
|
68
69
|
}
|
|
69
70
|
// Validate input
|
|
@@ -119,6 +120,21 @@ export class SeamRouter {
|
|
|
119
120
|
res.status(400).json(errorResult);
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
123
|
+
if (output.ok !== true) {
|
|
124
|
+
seamSpace.emit("apiError", output.error, {
|
|
125
|
+
routerPath: path,
|
|
126
|
+
procedureName: req.params.procName,
|
|
127
|
+
input,
|
|
128
|
+
validatedInput,
|
|
129
|
+
output,
|
|
130
|
+
validatedOutput,
|
|
131
|
+
request: req,
|
|
132
|
+
response: res,
|
|
133
|
+
next,
|
|
134
|
+
});
|
|
135
|
+
res.status(400).json(output.error);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
122
138
|
// Validate output
|
|
123
139
|
try {
|
|
124
140
|
validatedOutput = this.validateOutput(output, z.object({ ok: z.literal(true), data: procedure.output }).or(z.object({ ok: z.literal(false), error: z.any() })));
|