mirror of
				https://github.com/vector-im/element-web.git
				synced 2025-11-04 10:11:03 +01:00 
			
		
		
		
	Merge pull request #4009 from matrix-org/dbkr/log_exceptions_other_than_cancel
Log exceptions from accessSecretStorage
This commit is contained in:
		
						commit
						c111d70deb
					
				@ -37,6 +37,12 @@ function isCachingAllowed() {
 | 
				
			|||||||
    );
 | 
					    );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export class AccessCancelledError extends Error {
 | 
				
			||||||
 | 
					    constructor() {
 | 
				
			||||||
 | 
					        super("Secret storage access canceled");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getSecretStorageKey({ keys: keyInfos }) {
 | 
					async function getSecretStorageKey({ keys: keyInfos }) {
 | 
				
			||||||
    const keyInfoEntries = Object.entries(keyInfos);
 | 
					    const keyInfoEntries = Object.entries(keyInfos);
 | 
				
			||||||
    if (keyInfoEntries.length > 1) {
 | 
					    if (keyInfoEntries.length > 1) {
 | 
				
			||||||
@ -74,7 +80,7 @@ async function getSecretStorageKey({ keys: keyInfos }) {
 | 
				
			|||||||
    );
 | 
					    );
 | 
				
			||||||
    const [input] = await finished;
 | 
					    const [input] = await finished;
 | 
				
			||||||
    if (!input) {
 | 
					    if (!input) {
 | 
				
			||||||
        throw new Error("Secret storage access canceled");
 | 
					        throw new AccessCancelledError();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const key = await inputToKey(input);
 | 
					    const key = await inputToKey(input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -19,7 +19,7 @@ import PropTypes from 'prop-types';
 | 
				
			|||||||
import { _t } from '../../../languageHandler';
 | 
					import { _t } from '../../../languageHandler';
 | 
				
			||||||
import * as sdk from '../../../index';
 | 
					import * as sdk from '../../../index';
 | 
				
			||||||
import { MatrixClientPeg } from '../../../MatrixClientPeg';
 | 
					import { MatrixClientPeg } from '../../../MatrixClientPeg';
 | 
				
			||||||
import { accessSecretStorage } from '../../../CrossSigningManager';
 | 
					import { accessSecretStorage, AccessCancelledError } from '../../../CrossSigningManager';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const PHASE_INTRO = 0;
 | 
					const PHASE_INTRO = 0;
 | 
				
			||||||
const PHASE_BUSY = 1;
 | 
					const PHASE_BUSY = 1;
 | 
				
			||||||
@ -73,6 +73,9 @@ export default class CompleteSecurity extends React.Component {
 | 
				
			|||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } catch (e) {
 | 
					        } catch (e) {
 | 
				
			||||||
 | 
					            if (!(e instanceof AccessCancelledError)) {
 | 
				
			||||||
 | 
					                console.log(e);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            // this will throw if the user hits cancel, so ignore
 | 
					            // this will throw if the user hits cancel, so ignore
 | 
				
			||||||
            this.setState({
 | 
					            this.setState({
 | 
				
			||||||
                phase: PHASE_INTRO,
 | 
					                phase: PHASE_INTRO,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user