feat: API 예외 처리 및 오류 응답 형식 표준화

- Spring @ControllerAdvice를 사용하여 예외 처리 로직 중앙화
- 4xx, 5xx 오류에 대한 일관된 JSON 응답 형식 적용
- elink-online-common MessageUtil 클래스에 makeJsonErrorMessage 메소드 수정
This commit is contained in:
pksup
2025-12-11 13:32:46 +09:00
parent 0b98c8d11f
commit 7b3807300b
29 changed files with 1583 additions and 50 deletions
+22
View File
@@ -1,5 +1,26 @@
<%@page import="com.eactive.eai.common.util.MessageUtil"%>
<%@ page import="java.io.*, java.util.*"%>
<%@ page language="java" contentType="text/html;charset=utf-8" isErrorPage="true"%>
<%
Integer statusCode = (Integer) request.getAttribute("_authServerStatusCode");
if (statusCode != null) {
response.setStatus(statusCode);
}
String code;
if (statusCode != null && statusCode == 401) {
code = MessageUtil.ERROR_CODE_AUTH_FAIL;
} else if (statusCode != null && statusCode == 404) {
code = MessageUtil.ERROR_CODE_SERVICE_NOT_FOUND;
} else {
code = MessageUtil.ERROR_CODE_AP_ERROR;
}
String message = (String)request.getAttribute("errorMessage");
String jsonErrorMessage = MessageUtil.makeJsonErrorMessage(code, message);
out.println(jsonErrorMessage);
%>
<%--
<html>
<head>
<title>Error</title>
@@ -16,3 +37,4 @@
</body>
</html>
<% response.setStatus(200); %>
--%>