klubok 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18,10 +18,10 @@ function klubok(...fns) {
18
18
  return await Promise.resolve(fn(ctx)).then(resp => ({ ...ctx, [fn.key]: resp }));
19
19
  }
20
20
  catch (error) {
21
- throw (0, node_util_1.inspect)({
22
- error: error.stack ?? error.message ?? error,
23
- ctx,
24
- }, { depth: 3 });
21
+ if (error instanceof Error) {
22
+ error.stack += '\ncontext: ' + (0, node_util_1.inspect)(ctx);
23
+ }
24
+ throw error;
25
25
  }
26
26
  })())
27
27
  : (acc, fn) => acc.then(ctx => !fn.mutable && Reflect.has(ctx, fn.key) && !Reflect.has(mock ?? {}, fn.key)
@@ -36,10 +36,10 @@ function klubok(...fns) {
36
36
  : fn(ctx)).then(resp => ({ ...ctx, [fn.key]: resp }));
37
37
  }
38
38
  catch (error) {
39
- throw (0, node_util_1.inspect)({
40
- error: error.stack ?? error.message ?? error,
41
- ctx,
42
- }, { depth: 3 });
39
+ if (error instanceof Error) {
40
+ error.stack += '\ncontext: ' + (0, node_util_1.inspect)(ctx);
41
+ }
42
+ throw error;
43
43
  }
44
44
  })()), Promise.resolve({ ...rootCtx, ...mock }));
45
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "klubok",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Do notation pipes for Promise-based or pure functions which easy to mock",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",