diff --git a/ui/app/adapters/token.js b/ui/app/adapters/token.js index 5d7c002b2ec..09ea316afd4 100644 --- a/ui/app/adapters/token.js +++ b/ui/app/adapters/token.js @@ -1,5 +1,6 @@ import { inject as service } from '@ember/service'; import { default as ApplicationAdapter, namespace } from './application'; +import OTTExchangeError from '../utils/ott-exchange-error'; export default class TokenAdapter extends ApplicationAdapter { @service store; @@ -29,6 +30,8 @@ export default class TokenAdapter extends ApplicationAdapter { }); return store.peekRecord('token', store.normalize('token', token).data.id); + }).catch(() => { + throw new OTTExchangeError(); }); } } diff --git a/ui/app/routes/application.js b/ui/app/routes/application.js index 0c906f15a6c..b659d3c8105 100644 --- a/ui/app/routes/application.js +++ b/ui/app/routes/application.js @@ -4,7 +4,6 @@ import Route from '@ember/routing/route'; import { AbortError } from '@ember-data/adapter/error'; import RSVP from 'rsvp'; import { action } from '@ember/object'; -import OTTExchangeError from '../utils/ott-exchange-error'; import classic from 'ember-classic-decorator'; @classic @@ -38,7 +37,7 @@ export default class ApplicationRoute extends Route { try { await exchangeOneTimeToken; } catch (e) { - this.controllerFor('application').set('error', new OTTExchangeError()); + this.controllerFor('application').set('error', e); } const fetchSelfTokenAndPolicies = this.get('token.fetchSelfTokenAndPolicies')