kerium 1.3.0 → 1.3.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 +4 -0
- package/dist/error.js +5 -1
- package/package.json +1 -1
package/dist/error.d.ts
CHANGED
|
@@ -420,6 +420,10 @@ export interface ExceptionJSON {
|
|
|
420
420
|
dest?: string;
|
|
421
421
|
syscall?: string;
|
|
422
422
|
}
|
|
423
|
+
/**
|
|
424
|
+
* Set the message of an exception to the UV-style message.
|
|
425
|
+
*/
|
|
426
|
+
export declare function setUVMessage<T extends ExceptionJSON>(ex: T): T;
|
|
423
427
|
/**
|
|
424
428
|
* An error with additional information about what happened.
|
|
425
429
|
*
|
package/dist/error.js
CHANGED
|
@@ -406,7 +406,10 @@ export function strerror(errno) {
|
|
|
406
406
|
const _errno = typeof errno == 'string' ? Errno[errno] : errno;
|
|
407
407
|
return (_errno in errnoMessages ? errnoMessages[_errno] : '');
|
|
408
408
|
}
|
|
409
|
-
|
|
409
|
+
/**
|
|
410
|
+
* Set the message of an exception to the UV-style message.
|
|
411
|
+
*/
|
|
412
|
+
export function setUVMessage(ex) {
|
|
410
413
|
let message = `${ex.code}: ${errnoMessages[ex.errno]}, ${ex.syscall}`;
|
|
411
414
|
if (ex.path)
|
|
412
415
|
message += ` '${ex.path}'`;
|
|
@@ -415,6 +418,7 @@ function setUVMessage(ex) {
|
|
|
415
418
|
if (ex.message)
|
|
416
419
|
message += ` (${ex.message})`;
|
|
417
420
|
ex.message = message;
|
|
421
|
+
return ex;
|
|
418
422
|
}
|
|
419
423
|
/**
|
|
420
424
|
* An error with additional information about what happened.
|