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

Lifecycle hook error catching #14463

Closed

Conversation

petebacondarwin
Copy link
Contributor

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
fix

What is the current behavior? (You can also link to an open issue here)

Errors in hooks are not dealt with very nicely
See #14444

What is the new behavior (if this is a feature change)?

Errors are caught and passed to the exceptionHandler in a reasonable way, without causing the application as a whole to crash

Does this PR introduce a breaking change?

No

Please check if the PR fulfills these requirements

Other information:

$rootScope.$apply('a = 42');

// The first component's error should be logged
expect($exceptionHandler.errors[0].toString()).toEqual('Error: bad hook');
Copy link
Member

Choose a reason for hiding this comment

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

How come you didn't pop it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

a slip

@gkalpak
Copy link
Member

gkalpak commented Apr 19, 2016

LGTM

Previously, if one of these hooks threw an error, then any other `$onChanges`
hooks that had been scheduled were not executed, nor was the queue cleaned up
properly.

Closes angular#14444
Closes angular#14463
Previously, if one of these hooks threw an error, then the compilation
was terminated unceremoniously.

Closes angular#14444
Closes angular#14463
@petebacondarwin petebacondarwin force-pushed the lifecycle-hook-catching branch from 63ce920 to c57ed91 Compare April 19, 2016 19:19
Previously, if one of these hooks threw an error, then any other `$onChanges`
hooks that had been scheduled were not executed, nor was the queue cleaned up
properly.

Closes angular#14444
Closes angular#14463
petebacondarwin added a commit that referenced this pull request May 27, 2016
Previously, if one of these hooks threw an error, then the compilation
was terminated unceremoniously. In particular any other `$onChanges`
hooks that had been scheduled were not executed, nor was the queue cleaned
up properly.

Closes #14444
Closes #14463
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.

3 participants