1 | import { ResolutionStack } from './container';
|
2 | /**
|
3 | * An extendable error class.
|
4 | * @author https://github.com/bjyoungblood/es6-error/
|
5 | */
|
6 | export declare class ExtendableError extends Error {
|
7 | /**
|
8 | * Constructor for the error.
|
9 | *
|
10 | * @param {String} message
|
11 | * The error message.
|
12 | */
|
13 | constructor(message: string);
|
14 | }
|
15 | /**
|
16 | * Base error for all Awilix-specific errors.
|
17 | */
|
18 | export declare class AwilixError extends ExtendableError {
|
19 | }
|
20 | /**
|
21 | * Error thrown to indicate a type mismatch.
|
22 | */
|
23 | export declare class AwilixTypeError extends AwilixError {
|
24 | /**
|
25 | * Constructor, takes the function name, expected and given
|
26 | * type to produce an error.
|
27 | *
|
28 | * @param {string} funcDescription
|
29 | * Name of the function being guarded.
|
30 | *
|
31 | * @param {string} paramName
|
32 | * The parameter there was an issue with.
|
33 | *
|
34 | * @param {string} expectedType
|
35 | * Name of the expected type.
|
36 | *
|
37 | * @param {string} givenType
|
38 | * Name of the given type.
|
39 | */
|
40 | constructor(funcDescription: string, paramName: string, expectedType: string, givenType: any);
|
41 | /**
|
42 | * Asserts the given condition, throws an error otherwise.
|
43 | *
|
44 | * @param {*} condition
|
45 | * The condition to check
|
46 | *
|
47 | * string} funcDescription
{ |
48 | * Name of the function being guarded.
|
49 | *
|
50 | * @param {string} paramName
|
51 | * The parameter there was an issue with.
|
52 | *
|
53 | * string} expectedType
{ |
54 | * Name of the expected type.
|
55 | *
|
56 | * string} givenType
{ |
57 | * Name of the given type.
|
58 | */
|
59 | static assert<T>(condition: T, funcDescription: string, paramName: string, expectedType: string, givenType: any): NonNullable<T>;
|
60 | }
|
61 | /**
|
62 | * A nice error class so we can do an instanceOf check.
|
63 | */
|
64 | export declare class AwilixResolutionError extends AwilixError {
|
65 | /**
|
66 | * Constructor, takes the registered modules and unresolved tokens
|
67 | * to create a message.
|
68 | *
|
69 | * @param {string|symbol} name
|
70 | * The name of the module that could not be resolved.
|
71 | *
|
72 | * @param {string[]} resolutionStack
|
73 | * The current resolution stack
|
74 | */
|
75 | constructor(name: string | symbol, resolutionStack: ResolutionStack, message?: string);
|
76 | }
|
77 | /**
|
78 | * A nice error class so we can do an instanceOf check.
|
79 | */
|
80 | export declare class AwilixRegistrationError extends AwilixError {
|
81 | /**
|
82 | * Constructor, takes the registered modules and unresolved tokens
|
83 | * to create a message.
|
84 | *
|
85 | * @param {string|symbol} name
|
86 | * The name of the module that could not be registered.
|
87 | */
|
88 | constructor(name: string | symbol, message?: string);
|
89 | }
|