|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.xit.core.exception.handling;
|
|
|
|
|
|
|
|
|
|
import com.xit.core.constant.ErrorCode;
|
|
|
|
|
import com.xit.core.exception.CustomBaseException;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.boot.web.error.ErrorAttributeOptions;
|
|
|
|
|
import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
|
|
|
|
@ -32,11 +34,21 @@ public class CustomErrorAttributes extends DefaultErrorAttributes {
|
|
|
|
|
Map<String, Object> result = super.getErrorAttributes(webRequest, options);
|
|
|
|
|
//result.remove("timestamp");
|
|
|
|
|
//result.put("trace", "AAAAAAAAAAAAAAAAAAAAAAA");
|
|
|
|
|
log.error("=================================================================================");
|
|
|
|
|
|
|
|
|
|
final Throwable error = super.getError(webRequest);
|
|
|
|
|
if(error instanceof CustomBaseException){
|
|
|
|
|
ErrorCode errorCode = ((CustomBaseException) error).getErrorCode();
|
|
|
|
|
result.put("status", errorCode.getHttpStatus());
|
|
|
|
|
result.put("code", errorCode.getHttpStatus().toString());
|
|
|
|
|
result.put("message", errorCode.getMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.error("====================== Exception handler 에서 catch하지 못한 에러 :: CustomErrorAttributes 에서 처리 ==================================");
|
|
|
|
|
log.error("========================== 처리되지 않은 에러 발생 ==================================");
|
|
|
|
|
log.error("{}", result);
|
|
|
|
|
log.error("========================== 반드시 처리해 주세요 =====================================");
|
|
|
|
|
log.error("==================================================================================");
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
//return super.getErrorAttributes(webRequest, options);
|
|
|
|
|