Test for ErrorResource before accessing notification helper

pull/4338/head
Oliver Günther 9 years ago
parent 2c26ecdeec
commit 22be2d04e2
  1. 3
      frontend/app/components/wp-edit/wp-edit-form.directive.ts

@ -26,6 +26,7 @@
// See doc/COPYRIGHT.rdoc for more details.
// ++
import {ErrorResource} from "../api/api-v3/hal-resources/error-resource.service";
export class WorkPackageEditFormController {
public workPackage;
public fields = {};
@ -68,7 +69,7 @@ export class WorkPackageEditFormController {
this.$rootScope.$emit('workPackagesRefreshInBackground');
})
.catch((error) => {
if (!(error.data && error.hasOwnProperty('showErrorNotification')) {
if (!(error.data instanceof ErrorResource)) {
this.NotificationsService.addError("An internal error has occcurred.");
return deferred.reject([]);
}

Loading…
Cancel
Save