Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat($injector): print caller name in "unknown provider" errors (when available) #ngEurope #9721

Closed
wants to merge 2 commits into from

Conversation

ocombe
Copy link
Contributor

@ocombe ocombe commented Oct 21, 2014

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 print Error: [$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

@mary-poppins
Copy link

CLA verified!

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat!

@ocombe ocombe force-pushed the http-abort-status branch from 55329b0 to 34bfc62 Compare October 21, 2014 14:17
@ocombe ocombe force-pushed the http-abort-status branch from 34bfc62 to 66cc57f Compare October 21, 2014 14:20
@ocombe ocombe changed the title feat($injector): print caller name in "unknown provider" errors (when available) feat($injector): print caller name in "unknown provider" errors (when available) #ngEurope Oct 21, 2014
@caitp
Copy link
Contributor

caitp commented Oct 22, 2014

a test would be useful here, but I like it

@caitp caitp added this to the 1.3.x milestone Oct 22, 2014
@caitp caitp self-assigned this Oct 22, 2014
@pkozlowski-opensource
Copy link
Member

@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 :-/

@ocombe
Copy link
Contributor Author

ocombe commented Nov 28, 2014

Oh sure, I'll try to do it this week end !

@googlebot
Copy link

CLAs look good, thanks!

@pkozlowski-opensource
Copy link
Member

@ocombe no hurry but having tests and this patch landing would be totally awesome!!!

@ocombe
Copy link
Contributor Author

ocombe commented Nov 28, 2014

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.

@ocombe
Copy link
Contributor Author

ocombe commented Dec 2, 2014

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).
I hope that it's ok with you now.

@ocombe
Copy link
Contributor Author

ocombe commented Dec 2, 2014

Travis failed because of the huge DDOS attack from yesterday, any chance one of you could restart it please ? @pkozlowski-opensource @caitp

@lgalfaso
Copy link
Contributor

lgalfaso commented Dec 2, 2014

@ocombe just update your commit

git commit --amend --date "`date`"
git push -f

@caitp
Copy link
Contributor

caitp commented Dec 2, 2014

This looks good to me --- @lgalfaso want to land this?

@caitp
Copy link
Contributor

caitp commented Dec 2, 2014

I guess it's assigned to me, I'll do it

@caitp caitp closed this in 013b522 Dec 2, 2014
@ocombe
Copy link
Contributor Author

ocombe commented Dec 2, 2014

Woot my first contribution to angular.js !
Thanks @caitp :)

@caitp
Copy link
Contributor

caitp commented Dec 2, 2014

:D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide context for "unknown provider" errors.
8 participants