mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
handle download erros
This commit is contained in:
@@ -129,6 +129,7 @@ export class BSInstallerService{
|
||||
}
|
||||
else if(out[0] === "[Error]" as DownloadEventType){
|
||||
reject(out[1]);
|
||||
this.utils.newIpcSenc("bs-download.[Error]", {success: false, data: out[1]});
|
||||
this.killDownloadProcess();
|
||||
log.error("Download Event, Error", data.toString());
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import { ThemeService } from "./services/theme.service";
|
||||
import { NotificationOverlay } from "./components/notification/notification-overlay.component";
|
||||
import { BsDownloaderService } from "./services/bs-downloader.service";
|
||||
import { NotificationService } from "./services/notification.service";
|
||||
import { distinctUntilChanged, filter, throttleTime } from "rxjs";
|
||||
import { debounceTime, distinctUntilChanged, filter } from "rxjs";
|
||||
|
||||
export default function App() {
|
||||
|
||||
@@ -25,9 +25,13 @@ export default function App() {
|
||||
else { document.documentElement.classList.remove('dark'); }
|
||||
});
|
||||
|
||||
bsDownloadService.downloadWarning$.pipe(throttleTime(1000), filter(v => !!v), distinctUntilChanged()).subscribe(() => {
|
||||
bsDownloadService.downloadWarning$.pipe(filter(v => !!v), distinctUntilChanged(), debounceTime(100)).subscribe(() => {
|
||||
notificationService.notifyWarning({title: "Warning", desc: "Your connection seems unstable"});
|
||||
});
|
||||
|
||||
bsDownloadService.downloadError$.pipe(filter(v => !!v), distinctUntilChanged(), debounceTime(100)).subscribe(err => {
|
||||
notificationService.notifyError({title: "Error", desc: err});
|
||||
})
|
||||
}, [])
|
||||
|
||||
|
||||
|
||||
@@ -33,8 +33,9 @@ export function AvailableVersionsList() {
|
||||
bsDownloaderService.download(versionSelected).then(res => {
|
||||
progressBarService.hide(true);
|
||||
|
||||
if(res.success){ notificationService.notifySuccess({title: 'Download Complete', duration: 3000}); }
|
||||
else{ notificationService.notifyError({title: 'Error', desc: res.data as any as string}); }
|
||||
if(res.success){
|
||||
notificationService.notifySuccess({title: 'Download Complete', duration: 3000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ export class BsDownloaderService{
|
||||
|
||||
public readonly downloadProgress$: BehaviorSubject<number> = new BehaviorSubject(0);
|
||||
public readonly downloadWarning$: BehaviorSubject<string> = new BehaviorSubject(null);
|
||||
public readonly downloadError$: BehaviorSubject<string> = new BehaviorSubject(null);
|
||||
|
||||
public readonly selectedBsVersion$: BehaviorSubject<BSVersion> = new BehaviorSubject(null);
|
||||
|
||||
@@ -42,7 +43,9 @@ export class BsDownloaderService{
|
||||
|
||||
this.ipcService.watch<string>("bs-download.[SteamID]").subscribe(response => response.success && this.authService.setSteamID(response.data));
|
||||
|
||||
this.ipcService.watch<string>("bs-download.[Warning]").subscribe(response => response.success && this.downloadWarning$.next(response.data));
|
||||
this.ipcService.watch<string>("bs-download.[Warning]").subscribe(response => this.downloadWarning$.next(response.data));
|
||||
|
||||
this.ipcService.watch<string>("bs-download.[Error]").subscribe(response => this.downloadError$.next(response.data));
|
||||
|
||||
this.ipcService.watch<void>("bs-download.[2FA]").subscribe(async response => {
|
||||
if(!response.success){ return; }
|
||||
|
||||
Reference in New Issue
Block a user