if (_operatorAdapter.CanEditOperator(oper, OperatorSession)) { EditOperatorViewModel editOperatorViewModel = _editOperatorViewModelHelper.LoadEditOperatorViewModel(oper, OperatorSession.OpCode, OperatorSession.Rights); // Contact editOperatorViewModel.ContactPerson = _contactsAdapter.GetContactsAndChildrenById(editOperatorViewModel.ContactId); return Ok(editOperatorViewModel); } else { var response = Messages.cannotEditOperator; throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError ) { Content = new StringContent(response), ReasonPhrase = response }); }and I am also trying to handle this error in the controller's code.
app.factory('badRequestInterceptor', ['$rootScope', '$q', function ($rootScope, $q) { return { 'responseError': function (rejection) { if (rejection.status === 400) { $rootScope.$broadcast("sm:badRequest", rejection.data); } return $q.reject(rejection); } }; }]); app.factory('noConnectionInterceptor', ['$rootScope', '$q', function ($rootScope, $q) { return { 'responseError': function (rejection) { if (rejection.status === -1) { $rootScope.$broadcast("sm:noConnection"); } return $q.reject(rejection); } }; }]); app.factory('internalServerErrorInterceptor', ['$rootScope', '$q', function ($rootScope, $q) { return { 'responseError': function (rejection) { if (rejection.status === 500) { var errors = { message: 'An error has occurred. Please try again or contact system support.' }; $rootScope.$broadcast("sm:serverError", errors); } return $q.reject(rejection); } };and therefore the error is getting intercepted and it's not the response I want. I want to handle that error myself.