Created
February 5, 2015 19:00
-
-
Save mrosenberg/b3fcd37cbb7aab49d259 to your computer and use it in GitHub Desktop.
EmberJS Handling Promise Rejection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default Ember.Component.extend({ | |
actions: { | |
dismiss: function() { | |
this.set('message', null); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default Ember.Route.extend({ | |
error: function(error, transition) { | |
if(error) { | |
switch (error.status) { | |
case 416: | |
this.transitionTo(this.router.get('url')); | |
this.controllerFor('application').set('message', error.responseJSON.message); | |
break; | |
default: | |
break; | |
} | |
} | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment