[Task 72956] applied feedback to the delete eperson error message

This commit is contained in:
Raf Ponsaerts
2020-10-02 16:38:19 +02:00
parent 2621454cdb
commit fbe6ec61de
2 changed files with 6 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ import { EpersonDtoModel } from '../../../core/eperson/models/eperson-dto.model'
import { FeatureID } from '../../../core/data/feature-authorization/feature-id';
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
import { getAllSucceededRemoteDataPayload } from '../../../core/shared/operators';
import { RestResponse } from '../../../core/cache/response.models';
import { ErrorResponse, RestResponse } from '../../../core/cache/response.models';
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { RequestService } from '../../../core/data/request.service';
@@ -219,7 +219,8 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', { name: ePerson.name }));
this.reset();
} else {
this.notificationsService.error('Error occured when trying to delete EPerson with id: ' + ePerson.id + ' with code: ' + restResponse.statusCode + ' and message: ' + restResponse.statusText);
const errorResponse = restResponse as ErrorResponse;
this.notificationsService.error('Error occured when trying to delete EPerson with id: ' + ePerson.id + ' with code: ' + errorResponse.statusCode + ' and message: ' + errorResponse.errorMessage);
}
})
}}

View File

@@ -5,7 +5,7 @@ import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/comm
import { DSpaceRESTV2Response } from './dspace-rest-v2-response.model';
import { RestRequestMethod } from '../data/rest-request-method';
import { hasNoValue, isNotEmpty } from '../../shared/empty.util';
import { hasNoValue, hasValue, isNotEmpty } from '../../shared/empty.util';
import { DSpaceObject } from '../shared/dspace-object.model';
export const DEFAULT_CONTENT_TYPE = 'application/json; charset=utf-8';
@@ -53,7 +53,7 @@ export class DSpaceRESTv2Service {
return observableThrowError({
statusCode: err.status,
statusText: err.statusText,
message: err.message
message: (hasValue(err.error) && isNotEmpty(err.error.message)) ? err.error.message : err.message
});
}));
}
@@ -116,7 +116,7 @@ export class DSpaceRESTv2Service {
return observableThrowError({
statusCode: err.status,
statusText: err.statusText,
message: err.message
message: (hasValue(err.error) && isNotEmpty(err.error.message)) ? err.error.message : err.message
});
}));
}