Merge pull request 'feat/dev_251201' (#95) from feat/dev_251201 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/95
This commit is contained in:
@@ -13,11 +13,6 @@ import com.kamco.cd.kamcoback.postgres.entity.ErrorLogEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.log.ErrorLogRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.nio.file.AccessDeniedException;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
@@ -34,6 +29,12 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.client.HttpServerErrorException;
|
||||
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||
|
||||
import java.nio.file.AccessDeniedException;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Order(value = 1)
|
||||
@RestControllerAdvice
|
||||
@@ -463,8 +464,7 @@ public class GlobalExceptionHandler {
|
||||
String stackTraceStr =
|
||||
Arrays.stream(stackTrace)
|
||||
.map(StackTraceElement::toString)
|
||||
.collect(Collectors.joining("\n"))
|
||||
.substring(0, Math.min(stackTrace.length, 255));
|
||||
.collect(Collectors.joining("\n"));
|
||||
|
||||
ErrorLogEntity errorLogEntity =
|
||||
new ErrorLogEntity(
|
||||
@@ -484,7 +484,7 @@ public class GlobalExceptionHandler {
|
||||
public ApiResponseDto<String> handleCustomApiException(
|
||||
CustomApiException e, HttpServletRequest request) {
|
||||
log.warn("[CustomApiException] resource : {}", e.getMessage());
|
||||
|
||||
this.errorLog(request, e);
|
||||
String codeName = e.getCodeName();
|
||||
HttpStatus status = e.getStatus();
|
||||
// String message = e.getMessage() == null ? ApiResponseCode.getMessage(codeName) :
|
||||
@@ -521,6 +521,7 @@ public class GlobalExceptionHandler {
|
||||
public ApiResponseDto<String> handleMaxUploadSizeExceeded(
|
||||
MaxUploadSizeExceededException e, HttpServletRequest request) {
|
||||
log.warn("[MaxUploadSizeExceededException] resource :{} ", e.getMessage());
|
||||
this.errorLog(request, e);
|
||||
ApiResponseCode code = ApiResponseCode.PAYLOAD_TOO_LARGE;
|
||||
ErrorLogEntity errorLog =
|
||||
saveErrorLogData(
|
||||
|
||||
@@ -4,12 +4,12 @@ import com.kamco.cd.kamcoback.log.dto.ErrorLogDto;
|
||||
import com.kamco.cd.kamcoback.log.dto.EventType;
|
||||
import com.kamco.cd.kamcoback.postgres.CommonCreateEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@@ -33,8 +33,7 @@ public class ErrorLogEntity extends CommonCreateEntity {
|
||||
private String errorCode;
|
||||
private String errorMessage;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "stack_trace")
|
||||
@Column(name = "stack_trace", columnDefinition = "TEXT")
|
||||
private String stackTrace;
|
||||
|
||||
private Long handlerUid;
|
||||
|
||||
Reference in New Issue
Block a user