diff --git a/ui/app/routes/jobs/job.js b/ui/app/routes/jobs/job.js index abe106775..5ae53a122 100644 --- a/ui/app/routes/jobs/job.js +++ b/ui/app/routes/jobs/job.js @@ -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)); }, }); diff --git a/ui/app/utils/notify-error.js b/ui/app/utils/notify-error.js new file mode 100644 index 000000000..3ca5f5987 --- /dev/null +++ b/ui/app/utils/notify-error.js @@ -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); + }; +}