-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
refactor(nav): Exception in lifecycle will print stack trace #10974
Conversation
Now its very hard to tell what is the error and where it is coming from because the `_lifecycle` method doesn't print the exception stacktrace.
Perhaps, instead of fully catching the error in the lifecycle event, what do you think of re-throwing that error, so the global error handler could catch it? (IonicErrorHandler as default, but for example, I use rollbar, and this solution will also report to my rollbar account, not just have an error I wouldn't know about) btw, please review the commit message style next time you submit a PR. |
You are right. Looks like a better solution. |
I am not sure this is a good solution. The point of having a try/catch is to isolate NavController from the user's code. If the exception is rethrow, it could lead NavController to a inconsistent state. |
@manucorporat Then what will be the right way to see the stack trace when there is exception in the lifecycle methods? |
@manucorporat While I understand where you are coming from, the
If I understand that code correctly, this error will be catched by that try/catch, which is not the intended behaviour imo. Funny story - When I tested rollbar for the first time with my app, I threw an error from the |
I totally agree with you @AmitMY but rethrowing the exception is not an option. This way we could show nice the error output in screen without actually breaking NavController. |
@manucorporat The way I see it, because the |
that's not the problem. the problem is that lifecycle events are dispatched while a transition is ocurring, throwing an exception would interrupt the normal flow of a transition leaving internal variables in an inconsistent state. |
@AmitMY @royipressburger fixed here: 95c06a5 |
Short description of what this resolves:
Now its very hard to tell what is the error and where it is coming from because the
_lifecycle
method doesn't print the exception stacktrace.Changes proposed in this pull request:
-Just added
console.log
Ionic Version: 1.x / 2.x
2