The previous answer is outdated. In current Ember version (1+) events
are deprecated and you should use actions
object (instead of function).
Ember example:
App.ApplicationRoute = Ember.Route.extend({
actions: {
error: function(err) {
// error handler called in case of an error.
// show the error message to user here
// or transition to another route
}
}
});
Ember CLI example:
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
error: function(err) {
// error handler called in case of an error.
// show the error message to user here
// or transition to another route
}
}
});
With these action handlers the error will bubble nicely to the main application route if you don't stop it before in your route.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…