kerium 1.1.1 → 1.2.1

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
@@ -432,6 +432,9 @@ export declare class ErrnoException extends Error implements NodeJS.ErrnoExcepti
432
432
  toString(): string;
433
433
  toJSON(): ErrnoExceptionJSON;
434
434
  static fromJSON(this: void, json: ErrnoExceptionJSON): ErrnoException;
435
- static With(this: void, code: keyof typeof Errno, syscall?: string): ErrnoException;
436
435
  }
436
+ /**
437
+ * Shortcut to easily create an `ErrnoException` with a specific error code.
438
+ */
439
+ export declare function withErrno(this: void, code: keyof typeof Errno, message?: string, syscall?: string): ErrnoException;
437
440
  export {};
package/dist/error.js CHANGED
@@ -443,12 +443,14 @@ export class ErrnoException extends Error {
443
443
  const err = new ErrnoException(json.errno, json.message, json.syscall);
444
444
  err.code = json.code;
445
445
  err.stack = json.stack;
446
- Error.captureStackTrace?.(err, ErrnoException.fromJSON);
447
- return err;
448
- }
449
- static With(code, syscall) {
450
- const err = new ErrnoException(Errno[code], errnoMessages[Errno[code]], syscall);
451
- Error.captureStackTrace?.(err, ErrnoException.With);
452
446
  return err;
453
447
  }
454
448
  }
449
+ /**
450
+ * Shortcut to easily create an `ErrnoException` with a specific error code.
451
+ */
452
+ export function withErrno(code, message, syscall) {
453
+ const err = new ErrnoException(Errno[code], message ?? errnoMessages[Errno[code]], syscall);
454
+ Error.captureStackTrace?.(err, withErrno);
455
+ return err;
456
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kerium",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "POSIX-style errors, logging, and more",
5
5
  "author": "James Prevett <jp@jamespre.dev> (https://jamespre.dev)",
6
6
  "repository": {