MCPcopy Index your code
hub / github.com/nodejs/node / constructor

Method constructor

lib/internal/errors.js:645–676  ·  view source on GitHub ↗

* @param {object} ctx

(ctx)

Source from the content-addressed store, hash-verified

643 * @param {object} ctx
644 */
645 constructor(ctx) {
646 const { 0: code, 1: uvmsg } = uvErrmapGet(ctx.errno) || uvUnmappedError;
647 let message = `${code}: ${ctx.message || uvmsg}, ${ctx.syscall}`;
648
649 let path;
650 let dest;
651 if (ctx.path) {
652 path = ctx.path.toString();
653 message += ` '${path}'`;
654 }
655 if (ctx.dest) {
656 dest = ctx.dest.toString();
657 message += ` -> '${dest}'`;
658 }
659
660 super(message);
661
662 for (const prop of ObjectKeys(ctx)) {
663 if (prop === 'message' || prop === 'path' || prop === 'dest') {
664 continue;
665 }
666 this[prop] = ctx[prop];
667 }
668
669 this.code = code;
670 if (path) {
671 this.path = path;
672 }
673 if (dest) {
674 this.dest = dest;
675 }
676 }
677
678 get ['constructor']() {
679 return Error;

Callers

nothing calls this directly

Calls 2

uvErrmapGetFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected