- commit
- 25ec8ea
- parent
- cdc5721
- author
- Eric Bower
- date
- 2023-07-30 16:30:55 +0000 UTC
fix: `errorHandler` properly catch errors
1 files changed,
+5,
-5
+5,
-5
1@@ -20,14 +20,14 @@ export function* errorHandler<Ctx extends PipeCtx = PipeCtx>(
2 ctx: Ctx,
3 next: Next,
4 ) {
5- try {
6- yield* next();
7- } catch (err) {
8+ yield* next();
9+
10+ if (!ctx.result.ok) {
11 console.error(
12- `Error: ${err.message}. Check the endpoint [${ctx.name}]`,
13+ `Error: ${ctx.result.error.message}. Check the endpoint [${ctx.name}]`,
14 ctx,
15 );
16- throw err;
17+ console.error(ctx.result.error);
18 }
19 }
20