I've been doing lots of research on how to deal with errors best. Let's assume I have this AngularjS code:
$routeProvider
.when('/videomail/:key', {
templateUrl : 'view.html',
controller : 'ViewCtrl',
title : 'View',
hideHeader : true,
hideFooter : true,
resolve: {
videomail: function($rootScope, $route, Videomail) {
return Videomail.get({key: $route.current.params.key}).$promise.then(function(videomail) {
return videomail
}, function(err) {
// How can I present the error here?
// Should I return it like 'return err' and let the controller deal with it?
// Or can I forward this to another controller?
// PS: It can be a 404 or a 401 error
})
}
}
})
Check out my questions in the code comments. What can I try next?