kerium 1.0.1 → 1.1.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 +9 -3
- package/dist/error.js +12 -2
- package/package.json +1 -1
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;
|
|
@@ -425,7 +431,7 @@ export declare class ErrnoException extends Error implements NodeJS.ErrnoExcepti
|
|
|
425
431
|
constructor(errno: Errno, message?: string, syscall?: string);
|
|
426
432
|
toString(): string;
|
|
427
433
|
toJSON(): ErrnoExceptionJSON;
|
|
428
|
-
static fromJSON(json: ErrnoExceptionJSON): ErrnoException;
|
|
429
|
-
static With(code: keyof typeof Errno, syscall?: string): ErrnoException;
|
|
434
|
+
static fromJSON(this: void, json: ErrnoExceptionJSON): ErrnoException;
|
|
435
|
+
static With(this: void, code: keyof typeof Errno, syscall?: string): ErrnoException;
|
|
430
436
|
}
|
|
431
437
|
export {};
|
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;
|
|
@@ -436,9 +443,12 @@ export class ErrnoException extends Error {
|
|
|
436
443
|
const err = new ErrnoException(json.errno, json.message, json.syscall);
|
|
437
444
|
err.code = json.code;
|
|
438
445
|
err.stack = json.stack;
|
|
446
|
+
Error.captureStackTrace?.(err, ErrnoException.fromJSON);
|
|
439
447
|
return err;
|
|
440
448
|
}
|
|
441
449
|
static With(code, syscall) {
|
|
442
|
-
|
|
450
|
+
const err = new ErrnoException(Errno[code], errnoMessages[Errno[code]], syscall);
|
|
451
|
+
Error.captureStackTrace?.(err, ErrnoException.With);
|
|
452
|
+
return err;
|
|
443
453
|
}
|
|
444
454
|
}
|