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

Conversation

@lgalfaso
Copy link
Contributor

Cleanup the internal phase when there is a non-handled exception.

Closes: #13127

Cleanup the internal phase when there is a non-handled exception.

Closes: angular#13127
@lgalfaso lgalfaso force-pushed the digest-phase-cleanup branch from 79046cc to 6fa7e14 Compare October 27, 2015 21:07
@gkalpak
Copy link
Member

gkalpak commented Oct 28, 2015

I am not sure this is the right thing to do. There are already several try-catch blocks inside $digest.

AFAICT, the issue with phase not being cleared up only happens in tests (when using the mocked $exceptionHandler). The exception that causes this is already caught inside the $digest() and passed to the $exceptionHandler. Normally, the $exceptionHandler just logs the error and goes on.
The mocked handler used in tests (as part of ngMock) rethrows the error and that is why the phase doesn't get cleared.
Maybe, we could solve it more elegantly by taking care of it inside the mocked $exceptionHandler.

Still, this would not solve the issue in case someone overwrites the $exceptionHandler to actually throw errors, but anyone doing so would be asking for it anyway 😛

I'm not saying this is wrong or that I know of a better way (have only looked into it superficially) - just raising some concern :)

BTW, is there any perf-hit by the extra try-catch block ? This path is super-hot, isn't it ?

@lgalfaso
Copy link
Contributor Author

The more I think about this, then the more I think @gkalpak is right. The proper solution would need to come from angular-mock and $exceptionHandler

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants