mirror of
https://github.com/WowUp/WowUp.git
synced 2026-04-23 15:27:03 -04:00
Add in some error handling/display during the install/update process.
This commit is contained in:
@@ -146,6 +146,7 @@
|
||||
"protobufjs": "6.10.2",
|
||||
"rxjs": "6.6.3",
|
||||
"slug": "4.0.2",
|
||||
"ts-custom-error": "3.2.0",
|
||||
"uuid": "8.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,8 @@ export class AddonUpdateButtonComponent implements OnInit, OnDestroy {
|
||||
public getIsButtonActive() {
|
||||
return (
|
||||
this.listItem?.installState !== AddonInstallState.Unknown &&
|
||||
this.listItem?.installState !== AddonInstallState.Complete
|
||||
this.listItem?.installState !== AddonInstallState.Complete &&
|
||||
this.listItem?.installState !== AddonInstallState.Error
|
||||
);
|
||||
}
|
||||
|
||||
@@ -109,6 +110,8 @@ export class AddonUpdateButtonComponent implements OnInit, OnDestroy {
|
||||
return this._translateService.instant("COMMON.ADDON_STATUS.INSTALLING");
|
||||
case AddonInstallState.Pending:
|
||||
return this._translateService.instant("COMMON.ADDON_STATUS.PENDING");
|
||||
case AddonInstallState.Error:
|
||||
return this._translateService.instant("COMMON.ADDON_STATUS.ERROR");
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
1
wowup-electron/src/app/errors/index.ts
Normal file
1
wowup-electron/src/app/errors/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./install-error";
|
||||
7
wowup-electron/src/app/errors/install-error.ts
Normal file
7
wowup-electron/src/app/errors/install-error.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { CustomError } from "ts-custom-error";
|
||||
|
||||
export class InstallError extends CustomError {
|
||||
public constructor(message?: string, public addonName?: string) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -4,5 +4,6 @@ export enum AddonInstallState {
|
||||
BackingUp,
|
||||
Installing,
|
||||
Complete,
|
||||
Error,
|
||||
Unknown,
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import { WarcraftService } from "../warcraft/warcraft.service";
|
||||
import { WowUpService } from "../wowup/wowup.service";
|
||||
import { AddonProviderFactory } from "./addon.provider.factory";
|
||||
import { AddonFolder } from "../../models/wowup/addon-folder";
|
||||
import { InstallError } from "../../errors";
|
||||
|
||||
export enum ScanUpdateType {
|
||||
Start,
|
||||
@@ -71,11 +72,13 @@ export class AddonService {
|
||||
private readonly _addonInstalledSrc = new Subject<AddonUpdateEvent>();
|
||||
private readonly _addonRemovedSrc = new Subject<string>();
|
||||
private readonly _scanUpdateSrc = new BehaviorSubject<ScanUpdate>({ type: ScanUpdateType.Unknown });
|
||||
private readonly _installErrorSrc = new Subject<Error>();
|
||||
private readonly _installQueue = new Subject<InstallQueueItem>();
|
||||
|
||||
public readonly addonInstalled$ = this._addonInstalledSrc.asObservable();
|
||||
public readonly addonRemoved$ = this._addonRemovedSrc.asObservable();
|
||||
public readonly scanUpdate$ = this._scanUpdateSrc.asObservable();
|
||||
public readonly installError$ = this._installErrorSrc.asObservable();
|
||||
|
||||
constructor(
|
||||
private _addonStorage: AddonStorageService,
|
||||
@@ -89,8 +92,14 @@ export class AddonService {
|
||||
) {
|
||||
this._addonProviders = addonProviderFactory.getAll();
|
||||
|
||||
this._installQueue.pipe(mergeMap((item) => from(this.processInstallQueue(item)), 3)).subscribe((addonName) => {
|
||||
console.log("Install complete", addonName);
|
||||
this._installQueue.pipe(mergeMap((item) => from(this.processInstallQueue(item)), 3)).subscribe({
|
||||
next: (addonName) => {
|
||||
console.log("Install complete", addonName);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(error);
|
||||
this._installErrorSrc.next(error);
|
||||
},
|
||||
});
|
||||
|
||||
// Attempt to remove addons for clients that were lost
|
||||
@@ -323,6 +332,7 @@ export class AddonService {
|
||||
|
||||
let downloadedFilePath = "";
|
||||
let unzippedDirectory = "";
|
||||
|
||||
try {
|
||||
downloadedFilePath = await this._downloadService.downloadZipFile(
|
||||
addon.downloadUrl,
|
||||
@@ -395,9 +405,23 @@ export class AddonService {
|
||||
this.reconcileExternalIds(addon, queueItem.originalAddon);
|
||||
|
||||
queueItem.completion.resolve();
|
||||
|
||||
onUpdate?.call(this, AddonInstallState.Complete, 100);
|
||||
this._addonInstalledSrc.next({
|
||||
addon,
|
||||
installState: AddonInstallState.Complete,
|
||||
progress: 100,
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
queueItem.completion.reject(err);
|
||||
|
||||
onUpdate?.call(this, AddonInstallState.Error, 100);
|
||||
this._addonInstalledSrc.next({
|
||||
addon,
|
||||
installState: AddonInstallState.Error,
|
||||
progress: 100,
|
||||
});
|
||||
} finally {
|
||||
const unzippedDirectoryExists = await this._fileService.pathExists(unzippedDirectory);
|
||||
|
||||
@@ -412,13 +436,6 @@ export class AddonService {
|
||||
}
|
||||
}
|
||||
|
||||
onUpdate?.call(this, AddonInstallState.Complete, 100);
|
||||
this._addonInstalledSrc.next({
|
||||
addon,
|
||||
installState: AddonInstallState.Complete,
|
||||
progress: 100,
|
||||
});
|
||||
|
||||
return addon.name;
|
||||
};
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "Backup wird erstellt",
|
||||
"COMPLETE": "Vollständig",
|
||||
"DOWNLOADING": "Herunterladen...",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "Installieren...",
|
||||
"PENDING": "Ausstehend",
|
||||
"UNINSTALLING": "Deinstallieren...",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "Backing Up",
|
||||
"COMPLETE": "Installed",
|
||||
"DOWNLOADING": "Downloading",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "Installing",
|
||||
"PENDING": "Pending",
|
||||
"UNINSTALLING": "Uninstalling",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "Respaldando",
|
||||
"COMPLETE": "Instalado",
|
||||
"DOWNLOADING": "Descargando",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "Instalando",
|
||||
"PENDING": "Pendiente",
|
||||
"UNINSTALLING": "Desinstalando",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "Sauvegarde",
|
||||
"COMPLETE": "Installé",
|
||||
"DOWNLOADING": "Téléchargement",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "Installation",
|
||||
"PENDING": "En attente",
|
||||
"UNINSTALLING": "Désinstallation",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "Backup in corso",
|
||||
"COMPLETE": "Installato",
|
||||
"DOWNLOADING": "Download in corso",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "Installazione in corso",
|
||||
"PENDING": "In sospeso",
|
||||
"UNINSTALLING": "Disinstallazione in corso",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "백업 중",
|
||||
"COMPLETE": "설치됨",
|
||||
"DOWNLOADING": "다운로드 중",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "설치 중",
|
||||
"PENDING": "일시정지됨",
|
||||
"UNINSTALLING": "삭제 중",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "Sikkerhetskopierer",
|
||||
"COMPLETE": "Installert",
|
||||
"DOWNLOADING": "Laster Ned",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "Installerer",
|
||||
"PENDING": "Venter",
|
||||
"UNINSTALLING": "Avinstallerer",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "Fazendo Backup",
|
||||
"COMPLETE": "Instalado",
|
||||
"DOWNLOADING": "Baixando",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "Instalando",
|
||||
"PENDING": "Pendente",
|
||||
"UNINSTALLING": "Desinstalando",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "Резервное копирование",
|
||||
"COMPLETE": "Установлена",
|
||||
"DOWNLOADING": "Загружается",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "Устанавливается",
|
||||
"PENDING": "В ожидании",
|
||||
"UNINSTALLING": "Удаляется",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "正在備份",
|
||||
"COMPLETE": "已安裝",
|
||||
"DOWNLOADING": "正在下載",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "正在安裝",
|
||||
"PENDING": "等待中",
|
||||
"UNINSTALLING": "正在解除安裝",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"BACKINGUP": "正在备份",
|
||||
"COMPLETE": "已安装",
|
||||
"DOWNLOADING": "正在下载",
|
||||
"ERROR": "Error",
|
||||
"INSTALLING": "正在安装",
|
||||
"PENDING": "等待中",
|
||||
"UNINSTALLING": "正在卸载",
|
||||
|
||||
Reference in New Issue
Block a user