diff --git a/setup-wizard/src/app/pages/embassy/embassy.page.ts b/setup-wizard/src/app/pages/embassy/embassy.page.ts index bcc6d9ff4..d1b6b5457 100644 --- a/setup-wizard/src/app/pages/embassy/embassy.page.ts +++ b/setup-wizard/src/app/pages/embassy/embassy.page.ts @@ -93,6 +93,7 @@ export class EmbassyPage { try { this.stateService.torAddress = (await this.stateService.setupEmbassy()).torAddress } catch (e) { + this.errorToastService.present(`${e.message}: ${e.details}`) console.error(e.message) console.error(e.details) } finally { diff --git a/setup-wizard/src/app/pages/recover/recover.page.ts b/setup-wizard/src/app/pages/recover/recover.page.ts index e61e0ea0a..d7c1634c2 100644 --- a/setup-wizard/src/app/pages/recover/recover.page.ts +++ b/setup-wizard/src/app/pages/recover/recover.page.ts @@ -39,7 +39,7 @@ export class RecoverPage { try { this.recoveryDrives = (await this.apiService.getDrives()).filter(d => !!d['embassy_os']) } catch (e) { - this.errorToastService.present(e.message) + this.errorToastService.present(`${e.message}: ${e.data}`) } finally { this.loading = false } diff --git a/setup-wizard/src/app/pages/success/success.page.ts b/setup-wizard/src/app/pages/success/success.page.ts index 96df8cff8..aad33c5a8 100644 --- a/setup-wizard/src/app/pages/success/success.page.ts +++ b/setup-wizard/src/app/pages/success/success.page.ts @@ -30,7 +30,6 @@ export class SuccessPage { async goToEmbassy () { window.location.reload() - // await this.navCtrl.navigateForward(`/recover`, { animationDirection: 'forward' }) } async copyToClipboard (str: string): Promise { diff --git a/setup-wizard/src/app/services/state.service.ts b/setup-wizard/src/app/services/state.service.ts index b48a636f9..6f2563460 100644 --- a/setup-wizard/src/app/services/state.service.ts +++ b/setup-wizard/src/app/services/state.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core' import { BehaviorSubject } from 'rxjs'; import { ApiService, DiskInfo } from './api/api.service' +import { ErrorToastService } from './error-toast.service'; @Injectable({ providedIn: 'root' @@ -19,7 +20,8 @@ export class StateService { torAddress: string constructor( - private readonly apiService: ApiService + private readonly apiService: ApiService, + private errorToastService: ErrorToastService ) {} async pollDataTransferProgress(callback?: () => void) { @@ -30,15 +32,23 @@ export class StateService { this.dataTransferProgress?.totalBytes && this.dataTransferProgress.bytesTransfered === this.dataTransferProgress.totalBytes ) {return } - - const progress = await this.apiService.getDataTransferProgress() - this.dataTransferProgress = { - bytesTransfered: progress['bytes-transfered'], - totalBytes: progress['total-bytes'] + + + let progress + try { + progress =await this.apiService.getDataTransferProgress() + } catch (e) { + this.errorToastService.present(`${e.message}: ${e.details}`) } - if (this.dataTransferProgress.totalBytes) { - this.dataProgress = this.dataTransferProgress.bytesTransfered / this.dataTransferProgress.totalBytes - this.dataProgSubject.next(this.dataProgress) + if (progress) { + this.dataTransferProgress = { + bytesTransfered: progress['bytes-transfered'], + totalBytes: progress['total-bytes'] + } + if (this.dataTransferProgress.totalBytes) { + this.dataProgress = this.dataTransferProgress.bytesTransfered / this.dataTransferProgress.totalBytes + this.dataProgSubject.next(this.dataProgress) + } } this.pollDataTransferProgress(callback) }