Add error to debug panel

This commit is contained in:
J. Ryan Stinnett 2019-12-02 14:22:47 +00:00
parent 798d5c8ada
commit c21c0e1150

View File

@ -24,7 +24,10 @@ import Modal from '../../../Modal';
export default class CrossSigningPanel extends React.PureComponent { export default class CrossSigningPanel extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = this._getUpdatedStatus(); this.state = {
error: null,
...this._getUpdatedStatus(),
};
} }
_getUpdatedStatus() { _getUpdatedStatus() {
@ -44,6 +47,7 @@ export default class CrossSigningPanel extends React.PureComponent {
} }
_bootstrapSecureSecretStorage = async () => { _bootstrapSecureSecretStorage = async () => {
this.setState({ error: null });
try { try {
const InteractiveAuthDialog = sdk.getComponent("dialogs.InteractiveAuthDialog"); const InteractiveAuthDialog = sdk.getComponent("dialogs.InteractiveAuthDialog");
await MatrixClientPeg.get().bootstrapSecretStorage({ await MatrixClientPeg.get().bootstrapSecretStorage({
@ -63,6 +67,7 @@ export default class CrossSigningPanel extends React.PureComponent {
}, },
}); });
} catch (e) { } catch (e) {
this.setState({ error: e });
console.error(e); console.error(e);
} }
this.setState(this._getUpdatedStatus()); this.setState(this._getUpdatedStatus());
@ -71,11 +76,17 @@ export default class CrossSigningPanel extends React.PureComponent {
render() { render() {
const AccessibleButton = sdk.getComponent("elements.AccessibleButton"); const AccessibleButton = sdk.getComponent("elements.AccessibleButton");
const { const {
error,
crossSigningPublicKeysOnDevice, crossSigningPublicKeysOnDevice,
crossSigningPrivateKeysInStorage, crossSigningPrivateKeysInStorage,
secretStorageKeyInAccount, secretStorageKeyInAccount,
} = this.state; } = this.state;
let errorSection;
if (error) {
errorSection = <div className="error">{error.toString()}</div>;
}
return ( return (
<div> <div>
<table className="mx_CrossSigningPanel_statusList"><tbody> <table className="mx_CrossSigningPanel_statusList"><tbody>
@ -97,6 +108,7 @@ export default class CrossSigningPanel extends React.PureComponent {
{_t("Bootstrap Secure Secret Storage")} {_t("Bootstrap Secure Secret Storage")}
</AccessibleButton> </AccessibleButton>
</div> </div>
{errorSection}
</div> </div>
); );
} }