ionic-framework: NavController.loadPage does not handle promise rejection
Note: for support questions, please use one of these channels:
https://forum.ionicframework.com/ http://ionicworldwide.herokuapp.com/
Short description of the problem:
When you have an error in a second level page it does not propagate to the top level and it is not showed in the console
What behavior are you expecting?
Show errors in the console for all pages
Steps to reproduce:
- Create a start project ionic start test --v2 --ts
- Create a Page4
- Add an error in Page4. Like undefined error. 4.Do this.nav.push(Page4); in Page1
- Error will not be showed
This on Page1
goToPage4() {
this.nav.push(Page4).then(
response => {
console.log('Response ' + response);
},
error => {
console.log('Error: ' + error);
}
).catch(exception => {
console.log('Exception ' + exception);
});;
}
Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc) https://forum.ionicframework.com/t/ionic-2-error-not-showing-in-nav-push-somepage/49418/7
Which Ionic Version? 1.x or 2.x 2…0.0-beta.4
Plunker that shows an example of your issue
http://plnkr.co/edit/OBQjWnCgVkf7Z7mXezBs
Here it works but if you do it on a real project it does not.
Run ionic info from terminal/cmd prompt: (paste output below)
Cordova CLI: 6.1.1
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.1
Ionic CLI Version: 2.0.0-beta.17
Ionic App Lib Version: 2.0.0-beta.8
ios-deploy version: 1.7.0
ios-sim version: 4.1.1
OS: Mac OS X El Capitan
Node Version: v5.10.1
Xcode version: Xcode 7.3 Build version 7D175
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 30 (29 by maintainers)
@iignatov Both plunkrs work as expected (logging errors) for me on Safari but as you said, I can’t confirm that this solves the issue of running outside of plunkr. I will try to reproduce it locally tonight.
Quick note: I also had to stop and re-run on safari after clicking on the buttons because after the first error, the following ones would not be work but neither did the back button and other stuff. Not sure if this has any impact on what you were expecting.
@iignatov yes
@layton-glympse @lricoy Are you by chance also using Mac OS X? I guess that it’s something platform-specific because all reports are coming from Mac OS X. I opened a new issue (#6433) to track all of them.
+1, this is extremely annoying. I spent hours today trying to figure out why calls to this.nav.push() were dropping off a cliff. Turns out I had a syntax error in a template on the target page, and there was no error thrown indicating that.