@carlosv2/glue
Version:
Dependency injection library that stays out of the way
16 lines (15 loc) • 605 B
JavaScript
import { isString } from './utils.js';
import inspect from 'browser-util-inspect';
export class DiError extends Error {
constructor(message, context) {
const error = [
isString(message)
? `${message}`
: `Unable to continue due to the following error:\n${inspect(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'));
}
}