UNPKG

@carlosv2/glue

Version:

Dependency injection library that stays out of the way

23 lines (22 loc) 942 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DiError = void 0; const utils_1 = require("./utils"); const browser_util_inspect_1 = __importDefault(require("browser-util-inspect")); class DiError extends Error { constructor(message, context) { const error = [ (0, utils_1.isString)(message) ? `${message}` : `Unable to continue due to the following error:\n${(0, browser_util_inspect_1.default)(message)}\n\nStack trace:\n${message.stack}`, ]; if (context) { error.push(`This issue originated while processing \`${context.getId()}\` defined in \`${context.getPath()}\`:\n${context.getDefinition()}`); } super(error.join('\n\n')); } } exports.DiError = DiError;