diff --git a/ui/app/mixins/with-model-error-handling.js b/ui/app/mixins/with-model-error-handling.js new file mode 100644 index 000000000..585c61595 --- /dev/null +++ b/ui/app/mixins/with-model-error-handling.js @@ -0,0 +1,10 @@ +import Ember from 'ember'; +import notifyError from 'nomad-ui/utils/notify-error'; + +const { Mixin } = Ember; + +export default Mixin.create({ + model() { + return this._super(...arguments).catch(notifyError(this)); + }, +}); diff --git a/ui/app/routes/allocations/allocation.js b/ui/app/routes/allocations/allocation.js new file mode 100644 index 000000000..60eff663b --- /dev/null +++ b/ui/app/routes/allocations/allocation.js @@ -0,0 +1,6 @@ +import Ember from 'ember'; +import WithModelErrorHandling from 'nomad-ui/mixins/with-model-error-handling'; + +const { Route } = Ember; + +export default Route.extend(WithModelErrorHandling); diff --git a/ui/app/routes/servers/server.js b/ui/app/routes/servers/server.js index c4c67569f..60eff663b 100644 --- a/ui/app/routes/servers/server.js +++ b/ui/app/routes/servers/server.js @@ -1,10 +1,6 @@ import Ember from 'ember'; -import notifyError from 'nomad-ui/utils/notify-error'; +import WithModelErrorHandling from 'nomad-ui/mixins/with-model-error-handling'; const { Route } = Ember; -export default Route.extend({ - model() { - return this._super(...arguments).catch(notifyError(this)); - }, -}); +export default Route.extend(WithModelErrorHandling);