Merge pull request #5961 from opf/fix/error_message_on_activity

buble reject to avoid success handling by subsequent then
pull/5965/head
ulferts 7 years ago committed by GitHub
commit ae74980f75
  1. 14
      frontend/app/components/wp-activity/activity-service.ts

@ -37,7 +37,8 @@ export class ActivityService {
private $http:ng.IHttpService,
private I18n:op.I18n,
private wpNotificationsService:WorkPackageNotificationService,
private NotificationsService:any) {
private NotificationsService:any,
private $q:ng.IQService) {
}
public createComment(workPackage:WorkPackageResourceInterface, comment:string) {
@ -45,7 +46,7 @@ export class ActivityService {
{ comment: comment},
{ 'Content-Type': 'application/json; charset=UTF-8' }
)
.catch((error:any) => this.wpNotificationsService.handleErrorResponse(error, workPackage));
.catch((error:any) => this.errorAndReject(error, workPackage));
}
public updateComment(activity:HalResource, comment:string) {
@ -66,7 +67,14 @@ export class ActivityService {
);
return activity;
}).catch((error:any) => this.wpNotificationsService.handleErrorResponse(error));
}).catch((error:any) => this.errorAndReject(error));
}
private errorAndReject(error:HalResource, workPackage?:WorkPackageResourceInterface) {
this.wpNotificationsService.handleErrorResponse(error, workPackage);
// returning a reject will enable to correctly work with subsequent then/catch handlers.
return this.$q.reject(error);
}
}

Loading…
Cancel
Save