Skip to content

Commit c5fa376

Browse files
committed
Change Exception Message
1 parent afce58c commit c5fa376

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/com/longcoding/moon/interceptors/AbstractBaseInterceptor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,18 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
4545
return result;
4646
}
4747

48+
protected void generateException(String requestId, ExceptionType exceptionType) {
49+
logger.error("An error occurred. Request Id: {}, Exception Type: {}, Exception Code: {}, Http Status: {}", requestId, exceptionType.name(), exceptionType.getCode(), exceptionType.getHttpStatus());
50+
throw new GeneralException(exceptionType);
51+
}
52+
4853
protected void generateException(ExceptionType exceptionType) {
49-
logger.error("error occur in [{}]", getClass().getName());
54+
logger.error("An error occurred. Exception Type: {}, Exception Code: {}, Http Status: {}", exceptionType.name(), exceptionType.getCode(), exceptionType.getHttpStatus());
5055
throw new GeneralException(exceptionType);
5156
}
5257

5358
protected void generateException(ExceptionType exceptionType, String message) {
54-
logger.error("error occur in [{}]", getClass().getName());
59+
logger.error("An error occurred. Exception Type: {}, Exception Code: {}, Http Status: {}", exceptionType.name(), exceptionType.getCode(), exceptionType.getHttpStatus());
5560
throw new GeneralException(exceptionType, message);
5661
}
5762

0 commit comments

Comments
 (0)