in src/main/java/com/epam/digital/data/platform/excerpt/api/audit/ControllerAuditAspect.java [114:135]
private void prepareAndSendExceptionAudit(ResponseEntity<?> response,
AuditableException auditableException) {
var exceptionAuditEvent = new ExceptionAuditEvent();
String action;
if (response.getBody() instanceof DetailedErrorResponse) {
action = ((DetailedErrorResponse) response.getBody()).getCode();
} else {
action = response.getStatusCode().getReasonPhrase();
}
exceptionAuditEvent.setAction(action);
EventType eventType;
if (httpStatusOfSecurityAudit.contains(response.getStatusCodeValue())) {
eventType = EventType.SECURITY_EVENT;
} else {
eventType = EventType.USER_ACTION;
}
exceptionAuditEvent.setEventType(eventType);
exceptionAuditEvent.setUserInfoEnabled(auditableException.userInfoEnabled());
restAuditEventsFacade.sendExceptionAudit(exceptionAuditEvent);
}