Skip to content
Permalink
Browse files

[DDW-637] Handling open file error - adjustment

  • Loading branch information...
daniloprates committed May 14, 2019
1 parent e8c4104 commit b0c605e1ecedb364934e1ac7fd7356ebb466c557
Showing with 16 additions and 8 deletions.
  1. +16 −8 source/renderer/app/stores/WalletsStore.js
@@ -625,29 +625,36 @@ export default class WalletsStore extends Store {
} catch (error) {
runInAction('handle failed certificate download', () => {
// Reset progress
this._updateCertificateCreationState(false);
// User tries to replace a file that is open
if (error.syscall && error.syscall === 'open') {
this.generatingCertificateError = new WalletPaperWalletOpenPdfError();
}
this._updateCertificateCreationState(false, error);
});
}
};

_updateCertificateCreationState = action((state: boolean) => {
this.generatingCertificateInProgress = state;
});
_updateCertificateCreationState = action(
(state: boolean, error?: ?Object) => {
this.generatingCertificateInProgress = state;
if (error) {
// if (error && error.syscall && error.syscall === 'open') {
// User tries to replace a file that is open
this.generatingCertificateError = new WalletPaperWalletOpenPdfError();
} else {
this.generatingCertificateError = null;
}
}
);

@action _setCertificateTemplate = (params: { selectedTemplate: string }) => {
this.certificateTemplate = params.selectedTemplate;
this._updateCertificateStep();
};

@action _finishCertificate = () => {
this.generatingCertificateError = null;
this._closeCertificateGeneration();
};

@action _updateCertificateStep = (isBack: boolean = false) => {
this.generatingCertificateError = null;
const currrentCertificateStep = this.certificateStep || 0;
this.certificateStep = isBack
? currrentCertificateStep - 1
@@ -660,6 +667,7 @@ export default class WalletsStore extends Store {
};

@action _resetCertificateData = () => {
this.generatingCertificateError = null;
this.walletCertificatePassword = null;
this.walletCertificateAddress = null;
this.walletCertificateRecoveryPhrase = null;

0 comments on commit b0c605e

Please sign in to comment.
You can’t perform that action at this time.