Add queued snackbar, fix progress reducer
[arvados.git] / src / services / common-service / common-resource-service.ts
index cfae106b2dd5ed38746ca5ea1f5078990d77992f..f6810c0453b183a1db0847fe127a8dd607004d41 100644 (file)
@@ -41,7 +41,7 @@ export enum CommonResourceServiceError {
 
 export class CommonResourceService<T extends Resource> {
 
-    static mapResponseKeys = (response: { data: any }): Promise<any> =>
+    static mapResponseKeys = (response: { data: any }) =>
         CommonResourceService.mapKeys(_.camelCase)(response.data)
 
     static mapKeys = (mapFn: (key: string) => string) =>
@@ -73,8 +73,9 @@ export class CommonResourceService<T extends Resource> {
             .then(CommonResourceService.mapResponseKeys)
             .catch(({ response }) => {
                 actions.progressFn(reqId, false);
-                actions.errorFn(reqId, response.message);
-                Promise.reject<Errors>(CommonResourceService.mapResponseKeys(response));
+                const errors = CommonResourceService.mapResponseKeys(response) as Errors;
+                actions.errorFn(reqId, errors);
+                throw errors;
             });
     }