kerium 1.3.1 → 1.3.3

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/error.d.ts CHANGED
@@ -457,5 +457,6 @@ export declare function UV(this: void, code: keyof typeof Errno, context?: Excep
457
457
  * Shortcut to easily create an `ErrnoException` with a specific error code.
458
458
  */
459
459
  export declare function withErrno(this: void, code: keyof typeof Errno, message?: string): Exception;
460
+ export declare function rethrow(syscall: string, path?: string, dest?: string): (e: Exception) => never;
460
461
  export declare function rethrow(extra: ExceptionExtra): (e: Exception) => never;
461
462
  export {};
package/dist/error.js CHANGED
@@ -415,7 +415,7 @@ export function setUVMessage(ex) {
415
415
  message += ` '${ex.path}'`;
416
416
  if (ex.dest)
417
417
  message += ` -> '${ex.dest}'`;
418
- if (ex.message)
418
+ if (ex.message && ex.message !== errnoMessages[ex.errno])
419
419
  message += ` (${ex.message})`;
420
420
  ex.message = message;
421
421
  return ex;
@@ -491,9 +491,14 @@ export function withErrno(code, message) {
491
491
  Error.captureStackTrace?.(err, withErrno);
492
492
  return err;
493
493
  }
494
- export function rethrow(extra) {
494
+ export function rethrow(extra, path, dest) {
495
+ const ctx = typeof extra === 'string' ? { syscall: extra } : extra;
496
+ if (path)
497
+ ctx.path = path;
498
+ if (dest)
499
+ ctx.dest = dest;
495
500
  return function (e) {
496
- Object.assign(e, extra);
501
+ Object.assign(e, ctx);
497
502
  setUVMessage(e);
498
503
  throw e;
499
504
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kerium",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "POSIX-style errors, logging, and more",
5
5
  "author": "James Prevett <jp@jamespre.dev> (https://jamespre.dev)",
6
6
  "repository": {