diff --git a/src/CrossSigningManager.js b/src/CrossSigningManager.js index 6922214d19..2b3886fd94 100644 --- a/src/CrossSigningManager.js +++ b/src/CrossSigningManager.js @@ -37,6 +37,12 @@ function isCachingAllowed() { ); } +export class AccessCancelledError extends Error { + constructor() { + super("Secret storage access canceled"); + } +} + async function getSecretStorageKey({ keys: keyInfos }) { const keyInfoEntries = Object.entries(keyInfos); if (keyInfoEntries.length > 1) { @@ -74,7 +80,7 @@ async function getSecretStorageKey({ keys: keyInfos }) { ); const [input] = await finished; if (!input) { - throw new Error("Secret storage access canceled"); + throw new AccessCancelledError(); } const key = await inputToKey(input); diff --git a/src/components/structures/auth/CompleteSecurity.js b/src/components/structures/auth/CompleteSecurity.js index 66834deb2c..e7071bee0c 100644 --- a/src/components/structures/auth/CompleteSecurity.js +++ b/src/components/structures/auth/CompleteSecurity.js @@ -19,7 +19,7 @@ import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; import * as sdk from '../../../index'; import { MatrixClientPeg } from '../../../MatrixClientPeg'; -import { accessSecretStorage } from '../../../CrossSigningManager'; +import { accessSecretStorage, AccessCancelledError } from '../../../CrossSigningManager'; const PHASE_INTRO = 0; const PHASE_BUSY = 1; @@ -73,6 +73,9 @@ export default class CompleteSecurity extends React.Component { }); } } catch (e) { + if (!(e instanceof AccessCancelledError)) { + console.log(e); + } // this will throw if the user hits cancel, so ignore this.setState({ phase: PHASE_INTRO,