You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by dg...@apache.org on 2021/01/08 12:22:16 UTC

[incubator-datalab] branch DATALAB-2209 updated: [DATALAB-2209]: Fixed errors handling.

This is an automated email from the ASF dual-hosted git repository.

dgnatyshyn pushed a commit to branch DATALAB-2209
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/DATALAB-2209 by this push:
     new 5c42bda  [DATALAB-2209]: Fixed errors handling.
5c42bda is described below

commit 5c42bda1f85626b4943773d0160a3a4c9d37bfd7
Author: Dmytro_Gnatyshyn <di...@ukr.net>
AuthorDate: Fri Jan 8 14:21:38 2021 +0200

    [DATALAB-2209]: Fixed errors handling.
---
 .../webapp/src/app/core/services/project.service.ts        |  6 ++++--
 .../main/resources/webapp/src/app/core/util/errorUtils.ts  | 14 +++++++-------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts
index 7967329..1c71c2c 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts
@@ -67,9 +67,11 @@ export class ProjectService {
     return this.applicationServiceFacade
       .buildToggleProjectStatus(url, data)
       .pipe(
-        tap(v => console.log('service', v)),
         map(response => response),
-        catchError(ErrorUtils.handleServiceError));
+        catchError(err => {
+          console.log('service', typeof err, err);
+          return ErrorUtils.handleServiceError(err);
+        }));
   }
 
   public updateProjectsBudget(data): Observable<{}> {
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/errorUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/errorUtils.ts
index b23c05e..9a57036 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/util/errorUtils.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/util/errorUtils.ts
@@ -42,14 +42,14 @@ export class ErrorUtils {
 
   public static handleServiceError(errorMessage) {
     console.log('handleServiceError', errorMessage);
+    // if (errorMessage.indexOf('is not a function')  !== -1) {
+    //   observableThrowError({
+    //     status: 409,
+    //     statusText: 'Something went wrong',
+    //     message: 'Action failed because one of project resource is in processing stage'
+    //   });
+    // }
     const error = CheckUtils.isJSON(errorMessage.error) ? JSON.parse(errorMessage.error) : errorMessage.error;
-    if (!error) {
-      observableThrowError({
-        status: 409,
-        statusText: 'Something went wrong',
-        message: 'Something went wrong'
-      });
-    }
 
     return observableThrowError({
       status: error.code,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org