export class AlveoError extends Error { constructor(message: string) { super(message); this.name = this.constructor.name; } } export class ProviderNotFoundError extends AlveoError { constructor(token: string, context?: string) { const contextMsg = context ? ` in the "${context}" context` : ""; super( `Alveo can't resolve dependencies of the ${token}${contextMsg}. Please make sure that it is available in the current module scope.`, ); } } export class CircularDependencyError extends AlveoError { constructor(stack: string[]) { super(`Circular dependency detected: ${stack.join(" -> ")}`); } } export class InvalidModuleError extends AlveoError { constructor(target: string) { super( `The class "${target}" is not a valid Alveo module. Did you forget the @Module() decorator?`, ); } } export class InvalidProviderError extends AlveoError { constructor(provider: unknown) { super(`Invalid provider definition: ${JSON.stringify(provider)}`); } } export class LifecycleError extends AlveoError { constructor(hook: string, error: Error) { super(`Error during lifecycle hook "${hook}": ${error.message}`); } } export class BootstrapError extends AlveoError { constructor(message: string) { super(`Application bootstrap failed: ${message}`); } }