-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat($injector): print caller name in "unknown provider" errors (when available) #ngEurope #9721
Conversation
CLA verified! |
5dccd46
to
55329b0
Compare
return instanceInjector.invoke(provider.$get, provider, undefined, servicename); | ||
createInternalInjector(instanceCache, function(serviceName, caller) { | ||
var provider = providerInjector.get(serviceName + providerSuffix, caller); | ||
return instanceInjector.invoke(provider.$get, provider, undefined, serviceName); |
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.
Neat!
55329b0
to
34bfc62
Compare
34bfc62
to
66cc57f
Compare
a test would be useful here, but I like it |
@ocombe are you planning to work on this feature and add tests? I would love to see it land but we can't merge it without tests, I'm afraid :-/ |
Oh sure, I'll try to do it this week end ! |
CLAs look good, thanks! |
@ocombe no hurry but having tests and this patch landing would be totally awesome!!! |
But I'm not totally satisfied with the fact that it will add a new argument to the method $injector.get... if you have an idea on how to do it differently I'd love to hear it. |
Ok so I added 2 tests, and I fixed one error in the code in the mean time (it would print the service name 2 times for service injector errors). |
Travis failed because of the huge DDOS attack from yesterday, any chance one of you could restart it please ? @pkozlowski-opensource @caitp |
@ocombe just update your commit git commit --amend --date "`date`"
git push -f |
This looks good to me --- @lgalfaso want to land this? |
I guess it's assigned to me, I'll do it |
Woot my first contribution to angular.js ! |
:D |
This will add the name of the service/controller/... to the error message so that we know where the error comes from.
For example,
Error: [$injector:unpr] Unknown provider: $timeuotProvider <- $timeuot
will printError: [$injector:unpr] Unknown provider: $timeuotProvider <- $timeuot <- AppCtrl
This will not work in config/run block because propagating the module name would be difficult (you don't want to screw with invoke) but we could improve this later.
Also, I didn't add it to the directives because you already have an explicit message (something like
Error: [$injector:unpr] Unknown provider: $timeuotProvider <- $timeuot <- testDirective
).Fixes #8135