-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat($exceptionHandlerProvider): add mode logAndRethrow
#10564
feat($exceptionHandlerProvider): add mode logAndRethrow
#10564
Conversation
In the current angular-mocksSpec, the tests for $exceptionHandlerProvider call `module` to run tests on `$exceptionHandlerProvider.mode()`, but do not call `inject()` to pump the module definitions.
I think I agree that we should just log inside rethrow, since it won't do any harm and adding yet another config level seems unattractive and unnecessary. |
:) I'll redo it that way! |
Current behavior draws a distinction between `log` and `rethrow` modes of $exceptionHandler in ngMocks. This unifies the behaviors, with both modes logging the errors while the `log` mode does not throw. Closes #10540
* - `log`: Sometimes it is desirable to test that an error is thrown, for this case the `log` | ||
* mode stores an array of errors in `$exceptionHandler.errors`, to allow later | ||
* assertion of them. See {@link ngMock.$log#assertEmpty assertEmpty()} and | ||
* {@link ngMock.$log#reset reset()} | ||
* - `rethrow`: If any errors are passed to the handler in tests, it typically means that there | ||
* is a bug in the application or test, so this mock will make these tests fail. | ||
* For any impementations that expect exceptions to be thrown, the `rethrow` mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
@DavidSouther - thanks for this.
which I will also fix when merging |
@petebacondarwin The branch is closed - did you want me to fix the commit message, typo, and ask for reopen? |
I merged it into 1.3.x and 1.4.x already |
I closed the PR by mentioning it in the commit that landed in master |
Gotcha! I see where the merge happened; I'm just so used to seeing the On Tue Dec 23 2014 at 2:25:56 PM Pete Bacon Darwin notifications@github.com
|
Yes, in Angular we don't use GitHub's merge as we rather have a linear git history. |
Mode
logAndRethrow
captures the logged exception for later inspection by testassertions, while also throwing the exception for when the implementation
depends on thrown behavior (eg leaving the method early).
Depends on #10563
Closes #10540