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

Method constructor

lib/internal/errors.js:765–797  ·  view source on GitHub ↗
(err, syscall, address, port, additional)

Source from the content-addressed store, hash-verified

763 */
764class ExceptionWithHostPort extends Error {
765 constructor(err, syscall, address, port, additional) {
766 // TODO(joyeecheung): We have to use the type-checked
767 // getSystemErrorName(err) to guard against invalid arguments from users.
768 // This can be replaced with [ code ] = errmap.get(err) when this method
769 // is no longer exposed to user land.
770 util ??= require('util');
771 let code;
772 let details = '';
773 // True when permission model is enabled
774 if (isPermissionModelError(err)) {
775 code = err.code;
776 details = ` ${err.message}`;
777 } else {
778 code = util.getSystemErrorName(err);
779 if (port && port > 0) {
780 details = ` ${address}:${port}`;
781 } else if (address) {
782 details = ` ${address}`;
783 }
784 if (additional) {
785 details += ` - Local (${additional})`;
786 }
787 }
788 super(`${syscall} ${code}${details}`);
789
790 this.errno = err;
791 this.code = code;
792 this.syscall = syscall;
793 this.address = address;
794 if (port) {
795 this.port = port;
796 }
797 }
798
799 get ['constructor']() {
800 return Error;

Callers

nothing calls this directly

Calls 2

isPermissionModelErrorFunction · 0.85
requireFunction · 0.50

Tested by

no test coverage detected