feat: 🎸 add polling error notification and handling

This commit is contained in:
Randall Morey committed 2021-03-16 14:02:34 -04:00
1 parent 0219b5c99a
commit 760710ae23
1 file changed
+14
@@ -2,6 +2,8 @@ import Route from '@ember/routing/route';
import { getOwner } from '@ember/application';
import { inject as service } from '@ember/service';
import { task, timeout } from 'ember-concurrency';
import { action } from '@ember/object';
import { notifyError } from 'core/decorators/notify';
import config from '../../../../../config/environment';
const POLL_TIMEOUT_SECONDS = config.oidcPollingTimeoutSeconds;
@@ -65,4 +67,16 @@ export default class ScopesScopeAuthenticateMethodOidcRoute extends Route {
this.poller.cancelAll();
}
/**
* An error in this route indicates authentication failed. The user is
* notified and returned to the index.
*/
@action
@notifyError(() => 'errors.authentication-failed.title', { catch: true })
error(e) {
this.transitionTo('scopes.scope.authenticate.method.index');
// rethrow the error to activate the notifyError decorator
throw e;
}
}