kerium 1.0.1 → 1.1.0

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
@@ -414,7 +414,13 @@ export interface ErrnoExceptionJSON {
414
414
  syscall: string;
415
415
  }
416
416
  /**
417
- * An error with additional information about what happened
417
+ * An error with additional information about what happened.
418
+ *
419
+ * @remarks
420
+ *
421
+ * `Error.captureStackTrace` is used when available to hide irrelevant stack frames.
422
+ * This is being standardized, however it is not available in Deno and behind a flag in Firefox.
423
+ * See https://github.com/tc39/proposal-error-capturestacktrace for more details.
418
424
  */
419
425
  export declare class ErrnoException extends Error implements NodeJS.ErrnoException {
420
426
  errno: Errno;
package/dist/error.js CHANGED
@@ -406,7 +406,13 @@ export function strerror(errno) {
406
406
  return (_errno in errnoMessages ? errnoMessages[_errno] : '');
407
407
  }
408
408
  /**
409
- * An error with additional information about what happened
409
+ * An error with additional information about what happened.
410
+ *
411
+ * @remarks
412
+ *
413
+ * `Error.captureStackTrace` is used when available to hide irrelevant stack frames.
414
+ * This is being standardized, however it is not available in Deno and behind a flag in Firefox.
415
+ * See https://github.com/tc39/proposal-error-capturestacktrace for more details.
410
416
  */
411
417
  export class ErrnoException extends Error {
412
418
  errno;
@@ -419,6 +425,7 @@ export class ErrnoException extends Error {
419
425
  this.message = message;
420
426
  this.syscall = syscall;
421
427
  this.code = Errno[errno];
428
+ Error.captureStackTrace?.(this, this.constructor);
422
429
  }
423
430
  toString() {
424
431
  return this.code + ': ' + this.message;
@@ -439,6 +446,8 @@ export class ErrnoException extends Error {
439
446
  return err;
440
447
  }
441
448
  static With(code, syscall) {
442
- return new ErrnoException(Errno[code], errnoMessages[Errno[code]], syscall);
449
+ const err = new ErrnoException(Errno[code], errnoMessages[Errno[code]], syscall);
450
+ Error.captureStackTrace?.(err, this);
451
+ return err;
443
452
  }
444
453
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kerium",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "POSIX-style errors, logging, and more",
5
5
  "author": "James Prevett <jp@jamespre.dev> (https://jamespre.dev)",
6
6
  "repository": {