mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
wiz error handling
This commit is contained in:
committed by
Matt Hill
parent
a3085b7507
commit
1d98a8d61e
@@ -93,6 +93,7 @@ export class EmbassyPage {
|
|||||||
try {
|
try {
|
||||||
this.stateService.torAddress = (await this.stateService.setupEmbassy()).torAddress
|
this.stateService.torAddress = (await this.stateService.setupEmbassy()).torAddress
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
this.errorToastService.present(`${e.message}: ${e.details}`)
|
||||||
console.error(e.message)
|
console.error(e.message)
|
||||||
console.error(e.details)
|
console.error(e.details)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export class RecoverPage {
|
|||||||
try {
|
try {
|
||||||
this.recoveryDrives = (await this.apiService.getDrives()).filter(d => !!d['embassy_os'])
|
this.recoveryDrives = (await this.apiService.getDrives()).filter(d => !!d['embassy_os'])
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.errorToastService.present(e.message)
|
this.errorToastService.present(`${e.message}: ${e.data}`)
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export class SuccessPage {
|
|||||||
|
|
||||||
async goToEmbassy () {
|
async goToEmbassy () {
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
// await this.navCtrl.navigateForward(`/recover`, { animationDirection: 'forward' })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async copyToClipboard (str: string): Promise<boolean> {
|
async copyToClipboard (str: string): Promise<boolean> {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
import { ApiService, DiskInfo } from './api/api.service'
|
import { ApiService, DiskInfo } from './api/api.service'
|
||||||
|
import { ErrorToastService } from './error-toast.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -19,7 +20,8 @@ export class StateService {
|
|||||||
torAddress: string
|
torAddress: string
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly apiService: ApiService
|
private readonly apiService: ApiService,
|
||||||
|
private errorToastService: ErrorToastService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async pollDataTransferProgress(callback?: () => void) {
|
async pollDataTransferProgress(callback?: () => void) {
|
||||||
@@ -30,15 +32,23 @@ export class StateService {
|
|||||||
this.dataTransferProgress?.totalBytes &&
|
this.dataTransferProgress?.totalBytes &&
|
||||||
this.dataTransferProgress.bytesTransfered === this.dataTransferProgress.totalBytes
|
this.dataTransferProgress.bytesTransfered === this.dataTransferProgress.totalBytes
|
||||||
) {return }
|
) {return }
|
||||||
|
|
||||||
const progress = await this.apiService.getDataTransferProgress()
|
|
||||||
this.dataTransferProgress = {
|
let progress
|
||||||
bytesTransfered: progress['bytes-transfered'],
|
try {
|
||||||
totalBytes: progress['total-bytes']
|
progress =await this.apiService.getDataTransferProgress()
|
||||||
|
} catch (e) {
|
||||||
|
this.errorToastService.present(`${e.message}: ${e.details}`)
|
||||||
}
|
}
|
||||||
if (this.dataTransferProgress.totalBytes) {
|
if (progress) {
|
||||||
this.dataProgress = this.dataTransferProgress.bytesTransfered / this.dataTransferProgress.totalBytes
|
this.dataTransferProgress = {
|
||||||
this.dataProgSubject.next(this.dataProgress)
|
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)
|
this.pollDataTransferProgress(callback)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user