This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Circular dependency if exception during resource init #4361
Comments
What happens to the first thrown error? Does it swallowed somewhere? |
No, it interrupts the script and log to the console. |
I think that all broken dependencies leave the injector cache in this state, such that all subsequent requests for the same service (circular or not, even completely independent) will receive the "circular dependency found" error. |
And here's a patch I propose to fix this (this patch happens to be against 1.2.5)
Will test more and send a PR. |
metamatt
added a commit
to metamatt/angular.js
that referenced
this issue
Dec 31, 2013
getService flags services as INSTANTIATING while it calls their provider factory, in order to detect circular dependencies. If the service is instantiated correctly, the INSTANTIATING flag is overwritten with the actual service. However, if the service is not instantiated correctly, the INSTANTIATING flag should still be removed, or all further requests for this service will be mis-detected as a circular dependency. Closes angular#4361.
ghost
assigned IgorMinar
Dec 31, 2013
jamesdaily
pushed a commit
to jamesdaily/angular.js
that referenced
this issue
Jan 27, 2014
getService flags services as INSTANTIATING while it calls their provider factory, in order to detect circular dependencies. If the service is instantiated correctly, the INSTANTIATING flag is overwritten with the actual service. However, if the service is not instantiated correctly, the INSTANTIATING flag should still be removed, or all further requests for this service will be mis-detected as a circular dependency. Closes angular#4361 Closes angular#5577
jamesdaily
pushed a commit
to jamesdaily/angular.js
that referenced
this issue
Jan 27, 2014
getService flags services as INSTANTIATING while it calls their provider factory, in order to detect circular dependencies. If the service is instantiated correctly, the INSTANTIATING flag is overwritten with the actual service. However, if the service is not instantiated correctly, the INSTANTIATING flag should still be removed, or all further requests for this service will be mis-detected as a circular dependency. Closes angular#4361 Closes angular#5577
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
class MyResource extends $resource("/test", { arg: throw "holy shit!" })
the first time the resource is needed, the exception is throw.
the second time "Error: [$injector:cdep] Circular dependency found: "
It seems that the resource is in cache as an empty object and is considered as INSTANTIATING:
(cache[serviceName] === INSTANTIATING) returns true
The text was updated successfully, but these errors were encountered: