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

fix($compile): do not swallow thrown errors in test #15631

Closed
wants to merge 1 commit into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Jan 20, 2017

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

What is the current behavior? (You can also link to an open issue here)
Since e13eeab, errors/rejections produces during fetching the template or compiling an asynchronous directive, where overzealously silenced. This doesn't make any difference in (most) production apps, where $exceptionHandler does not rethrow the errors. In tests though (where $exceptionHandler rethrows by default), it can unexpectedly "swallow" thrown errors.
See also #15629.

What is the new behavior (if this is a feature change)?
The extraneous .catch(noop) has been removed, thus letting errors thrown by $exceptionHandler to surface.

Does this PR introduce a breaking change?
No
(It is possible that exceptions might pop up in tests, but they where previously incorrectly hidden. Also note that the only modification in tests were to restore them to their pre-1.6.0-rc.0 state.)

Please check if the PR fulfills these requirements

Other information:
The changes in 'compileSpec.js' essentially revert the modifications that were unnecessarily (and incorrectly) done in e13eeab (and also one incorrect modification from c22615c).

Fixes #15629

In e13eeab, errors/rejections produces during fetching the template or compiling
an asynchronous directive, where overzealously silenced. This doesn't make any
difference in (most) production apps, where `$exceptionHandler` does not rethrow
the errors. In tests though (where `$exceptionHandler` rethrows by default), it
can unexpectedly "swallow" thrown errors.

This commit fixes it by removing the extraneous `.catch(noop)`, thus letting
errors thrown by `$exceptionHandler` to surface.

The changes in 'compileSpec.js' essentially revert the modifications that were
unnecessarily (and incorrectly) done in e13eeab (and also one incorrect
modification from [c22615c][1]).

[1]: angular@c22615c#diff-348c2f3781ed66a24894c2046a52c628L2084

Fixes angular#15629
@lgalfaso
Copy link
Contributor

lgalfaso commented Jan 20, 2017 via email

@gkalpak
Copy link
Member Author

gkalpak commented Jan 20, 2017

Is this a breaking change?

It depends how you look at it 😁

First of all, this will have no effect in cases where $exceptionHandler does not throw an exception. This is indeed the case in most production apps (and if it isn't, people will run into bigger problems, such as half-finished digest cycles and inconsistent state).

In cases where $exceptionHandler rethrows (the default behavior in tests), this PR will restore the 1.5.x behavior (throwing), which was unintentionally changed/broken in e13eeab (starting to swallow errors).

tl;dr
Theoretically, this PR fixes a regression introduced by e13eeab in 1.6.0-rc.0.
Practically, it is possible that people have written tests that pass with 1.6.0-rc.0+ but fail with this PR.

@lgalfaso
Copy link
Contributor

I am fine with the explanation for not calling this a BR. LGTM

@Narretz
Copy link
Contributor

Narretz commented Jan 30, 2017

LGTM

@gkalpak gkalpak closed this in 03dbd94 Jan 30, 2017
gkalpak added a commit that referenced this pull request Jan 30, 2017
In e13eeab, errors/rejections produced during fetching the template or compiling
an asynchronous directive, where overzealously silenced. This doesn't make any
difference in (most) production apps, where `$exceptionHandler` does not rethrow
the errors. In tests though (where `$exceptionHandler` rethrows by default), it
can unexpectedly "swallow" thrown errors.

This commit fixes it by removing the extraneous `.catch(noop)`, thus letting
errors thrown by `$exceptionHandler` to surface.

The changes in 'compileSpec.js' essentially revert the modifications that were
unnecessarily (and incorrectly) done in e13eeab (and also one incorrect
modification from [c22615c][1]).

[1]: c22615c#diff-348c2f3781ed66a24894c2046a52c628L2084

Fixes #15629

Closes #15631
ellimist pushed a commit to ellimist/angular.js that referenced this pull request Mar 15, 2017
In e13eeab, errors/rejections produced during fetching the template or compiling
an asynchronous directive, where overzealously silenced. This doesn't make any
difference in (most) production apps, where `$exceptionHandler` does not rethrow
the errors. In tests though (where `$exceptionHandler` rethrows by default), it
can unexpectedly "swallow" thrown errors.

This commit fixes it by removing the extraneous `.catch(noop)`, thus letting
errors thrown by `$exceptionHandler` to surface.

The changes in 'compileSpec.js' essentially revert the modifications that were
unnecessarily (and incorrectly) done in e13eeab (and also one incorrect
modification from [c22615c][1]).

[1]: angular@c22615c#diff-348c2f3781ed66a24894c2046a52c628L2084

Fixes angular#15629

Closes angular#15631
@gkalpak gkalpak deleted the fix-compile-rethrow-errors branch April 27, 2017 11:50
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.

missing required controllers doesn't result in an exception in tests
4 participants