-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error messages information (#70) #88
Improve error messages information (#70) #88
Conversation
src/__tests__/errors.test.ts
Outdated
expect(() => { | ||
globalContainer.resolve(A); | ||
}).toThrow( | ||
/Cannot inject the dependency "b" at position #1 of "A" constructor. Reason:\s+Cannot inject the dependency "c" at position #0 of "B" constructor. Reason:\s+Cannot inject the dependency "s" at position #0 of "C" constructor. Reason:\s+TypeInfo not known for "Object"/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Any way we can format this to be a little more readable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/ /,/ /].map(x=>x.source).join()
as in b11ea0c
makes readability any better?
src/dependency-container.ts
Outdated
|
||
return new ctor(...params); | ||
} | ||
|
||
private resolveParams<T>(context: ResolutionContext, ctor: constructor<T>) { | ||
return (param: any, idx: number) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the specific types rather than any
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I need to remove any
from typeInfo
map.
Something like this 144e07f it's ok?
To address #70 handling composition of error messages with some helpers.
Example:
Will throw an exception like this: