import { Class, DiError } from './types-and-models.js'; /** * Thrown when trying to retrieve a dependency by key from `Injector`, but the * `Injector` does not have a `Provider` for the given key. * * ### Example * ```ts @injectable() class A { constructor(b:B) {} } expect(() => Injector.resolveAndCreate([A])).toThrow(); ``` */ export declare function noProviderError(tokens: any[]): DiError; /** * Thrown when dependencies form a cycle. * * ### Example * ```ts @injectable() class A { constructor(b: B) {} } @injectable() class B { constructor(a: A) {} } ``` * * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed. */ export declare function cyclicDependencyError(tokens: any[]): DiError; /** * Thrown when a constructing type returns with an Error. * * The `InstantiationError` class contains the original error plus the dependency graph which caused * this object to be instantiated. * * ### Example * ```ts class A { constructor() { throw new Error('message'); } } let injector = Injector.resolveAndCreate([A]); try { injector.get(A); } catch (e) { expect(e instanceof InstantiationError).toBe(true); expect(e.originalException.message).toEqual("message"); expect(e.originalStack).toBeDefined(); } ``` */ export declare function instantiationError(originalException: any, tokens: any[]): any; /** * Thrown when an object other then `Provider` (or `Class`) is passed to `Injector` * creation. * * ### Example * ```ts expect(() => Injector.resolveAndCreate(["not a type"])).toThrow(); ``` */ export declare function invalidProviderError(provider: any): DiError; /** * Thrown when the class has no annotation information. * * Lack of annotation information prevents the `Injector` from determining which dependencies * need to be injected into the constructor. * * ### Example * ```ts class A { constructor(b) {} } expect(() => Injector.resolveAndCreate([A])).toThrow(); ``` * * This error is also thrown when the class not marked with `injectable` has parameter types. * ```ts class B {} class A { constructor(b:B) {} // no information about the parameter types of A is available at runtime. } expect(() => Injector.resolveAndCreate([A,B])).toThrow(); ``` */ export declare function noAnnotationError(Cls: Class, params: any[], propertyKey?: string | symbol): DiError; /** * Thrown when a multi provider and a regular provider are bound to the same token. * * ### Example * ```ts expect(() => Injector.resolveAndCreate([ { provide: "Strings", useValue: "string1", multi: true}, { provide: "Strings", useValue: "string2", multi: false} ])).toThrow(); ``` */ export declare function mixMultiProvidersWithRegularProvidersError(token: NonNullable): DiError; //# sourceMappingURL=error-handling.d.ts.map