From b7e333f1cc9ab5492d50146e76acd2d4c8a14658 Mon Sep 17 00:00:00 2001
From: Chris Hines <chris.hines@monash.edu>
Date: Tue, 19 May 2020 22:24:52 +1000
Subject: [PATCH] add notifications when the stat command doesn't work

---
 src/app/jobs.service.ts | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/app/jobs.service.ts b/src/app/jobs.service.ts
index 96b1f7c..4417d39 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});
   }
-- 
GitLab