Handle 404s on jobs
This commit is contained in:
parent
af9f76aae5
commit
35f198d787
|
@ -1,4 +1,5 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
import notifyError from 'nomad-ui/utils/notify-error';
|
||||||
|
|
||||||
const { Route, inject } = Ember;
|
const { Route, inject } = Ember;
|
||||||
|
|
||||||
|
@ -10,6 +11,7 @@ export default Route.extend({
|
||||||
.find('job', job_id)
|
.find('job', job_id)
|
||||||
.then(job => {
|
.then(job => {
|
||||||
return job.get('allocations').then(() => job);
|
return job.get('allocations').then(() => job);
|
||||||
});
|
})
|
||||||
|
.catch(notifyError(this));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
7
ui/app/utils/notify-error.js
Normal file
7
ui/app/utils/notify-error.js
Normal 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);
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue