diff --git a/src/app/jobs.service.ts b/src/app/jobs.service.ts index 96b1f7c454deb6b23129a2ee147436d0d25b9fb4..4417d39a11d051b501beda4f5385c8ecadca5b16 100644 --- a/src/app/jobs.service.ts +++ b/src/app/jobs.service.ts @@ -7,6 +7,8 @@ import { Identity } from './identity'; import { Subscription, interval, pipe, Observable } from 'rxjs'; import { BehaviorSubject, timer } from 'rxjs'; import { repeat } from 'rxjs/operators'; +import { NotificationsService } from './notifications.service'; + @Injectable({ providedIn: 'root' @@ -16,7 +18,7 @@ export class JobsService { private tsub: Subscription; private id: Identity; - constructor(private tes: TesService, private authService: AuthorisationService) { + constructor(private tes: TesService, private authService: AuthorisationService, private notifications: NotificationsService ) { this.jobs$ = new BehaviorSubject([]); } @@ -39,6 +41,11 @@ export class JobsService { } public getJobsError(error,identity: Identity) { + if (error.hasOwnProperty("error") && error.error.hasOwnProperty("message")) { + this.notifications.notify(error.error.message); + this.tsub.unsubscribe(); + return; + } this.tsub.unsubscribe() this.authService.updateAgentContents().subscribe((_) => {return}); }