Handle 404s on jobs

This commit is contained in:
Michael Lange 2017-09-28 10:06:13 -07:00
parent af9f76aae5
commit 35f198d787
2 changed files with 10 additions and 1 deletions

View file

@ -1,4 +1,5 @@
import Ember from 'ember';
import notifyError from 'nomad-ui/utils/notify-error';
const { Route, inject } = Ember;
@ -10,6 +11,7 @@ export default Route.extend({
.find('job', job_id)
.then(job => {
return job.get('allocations').then(() => job);
});
})
.catch(notifyError(this));
},
});

View file

@ -0,0 +1,7 @@
// An error handler to provide to a promise catch to set an error
// on the application controller.
export default function notifyError(route) {
return error => {
route.controllerFor('application').set('error', error);
};
}