Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not re-raise on errors handled in route error action. #12752

Merged
merged 4 commits into from
Dec 27, 2015

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Dec 27, 2015

All of the hard work here was done by @minasmart over in #12549.

Fixes #12547.
Fixes #12472.
Fixes #12166.

Mina Smart and others added 3 commits December 27, 2015 10:33
Ember 2.1 introduced a regression where all errors during a transition
were thrown, even when those errors had been handled in a route's error
action. This PR adds a test to identify the regression, and adds some
logic and state to identify errors that have been handled, and not
reraise them, while maintaining the desired behaviour of throwing errors
that aren't handled.

This is especially valuable in any application that tests error
handling. Since all errors were being thrown regardless of handling,
failed assertions were being registered by qunit, and it became
impossible to test application flow that entered the error hook.

Further details about this issue are here:
emberjs#12547

Remove leftover debugger

This addresses an issue where handled errors are still thrown

The added test passes on Ember 2.0. It fails on Ember 2.1 because even though
the error is not bubbled, the application throws the handled error.

This is contrary to what the documentation indicates.

Full details about this issue are here: emberjs#12547

This PR also adds a very naive implementation of how to flag an error as having
been handled and prevents reraising, while retaining the functionality of throwing errors
that aren't caught, or are bubbled from the application route

Make error checking methods a part of the router instance

Attach error caching methods to EmberRouter, and use guids for errors

Errors used as keys were just getting `.toString()`ed, so multiple
`Error`s or hashes would all have the same key. This update uses ember
`guidFor` to uniquely identify errors. Thanks for the help @rwjblue!

When creating a new promise, resolve it. Don't fork the promise

Tests expecting errors to bubble up, should bubble errors
This provides insurance that handled errors aren't swallowed
rwjblue added a commit that referenced this pull request Dec 27, 2015
Do not re-raise on errors handled in route error action.
@rwjblue rwjblue merged commit 91b0ebb into emberjs:master Dec 27, 2015
@rwjblue rwjblue deleted the rebase-12549 branch December 27, 2015 17:20
@minasmart
Copy link

Wooooooooooooooooooooo

@rwjblue
Copy link
Member Author

rwjblue commented Dec 27, 2015

Pulled into beta branch, should be published to bower/S3 soon so we can test.

@blimmer
Copy link

blimmer commented Jan 17, 2016

Is there a workaround for this in 2.2.x?

@rwjblue
Copy link
Member Author

rwjblue commented Jan 17, 2016

Not at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants