UNPKG

@enspirit/emb

Version:

A replacement for our Makefile-for-monorepos

116 lines (115 loc) 2.78 kB
export class EMBError extends Error { code; message; constructor(code, message) { super(message); this.code = code; this.message = message; } toCliError(suggestions, ref) { return new CliError(this.code, this.message, suggestions, ref); } } export class CliError extends EMBError { code; message; suggestions; ref; constructor( /** * a unique error code for this error class */ code, /** * message to display related to the error */ message, /** * a suggestion that may be useful or provide additional context */ suggestions, /** * a url to find out more information related to this error * or fixing the error */ ref) { super(code, message); this.code = code; this.message = message; this.suggestions = suggestions; this.ref = ref; } } export class AmbiguousReferenceError extends EMBError { ref; matches; constructor(msg, ref, matches) { super('AMBIGUOUS_REF', msg); this.ref = ref; this.matches = matches; } } export class UnkownReferenceError extends EMBError { ref; constructor(msg, ref) { super('UNKNOWN_REF', msg); this.ref = ref; } } export class ItemCollisionsError extends EMBError { collisions; constructor(msg, collisions) { super('ITEM_COLLISIONS', msg); this.collisions = collisions; } } export class CircularDependencyError extends EMBError { deps; constructor(msg, deps) { super('CIRCULAR_DEPS', msg); this.deps = deps; } } export class ShellExitError extends EMBError { service; exitCode; signal; constructor(msg, service, exitCode, signal) { super('SHELL_EXIT_ERR', msg); this.service = service; this.exitCode = exitCode; this.signal = signal; } } export class NoContainerFoundError extends EMBError { component; constructor(msg, component) { super('CMP_NO_CONTAINER', msg); this.component = component; } } export class MultipleContainersFoundError extends EMBError { component; constructor(msg, component) { super('CMP_NO_CONTAINER', msg); this.component = component; } } export class CommandExecError extends EMBError { exitCode; signal; constructor(msg, exitCode, signal) { super('COMMAND_EXEC_ERR', msg); this.exitCode = exitCode; this.signal = signal; } } export class ComposeExecError extends EMBError { exitCode; signal; constructor(msg, exitCode, signal) { super('COMPOSE_EXEC_ERR', msg); this.exitCode = exitCode; this.signal = signal; } }