Skip to content

Commit

Permalink
[#12235]Fix the incorrect logging format in the ResponseExceptionHand…
Browse files Browse the repository at this point in the history
…ler of the naming module.
  • Loading branch information
HMYDK committed Jun 17, 2024
1 parent d68b904 commit 0e20a56
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public class ResponseExceptionHandler {
*/
@ExceptionHandler(NacosException.class)
public ResponseEntity<String> handleNacosException(NacosException e) {
Loggers.SRV_LOG.error("got exception. {}", e.getErrMsg(), ExceptionUtil.getAllExceptionMsg(e));
Loggers.SRV_LOG.error("got exception. {}", ExceptionUtil.getAllExceptionMsg(e));
return ResponseEntity.status(e.getErrCode()).body(e.getMessage());
}

/**
* Handle {@link com.alibaba.nacos.api.exception.runtime.NacosRuntimeException}.
*
Expand All @@ -54,7 +54,7 @@ public ResponseEntity<String> handleNacosException(NacosException e) {
*/
@ExceptionHandler(NacosRuntimeException.class)
public ResponseEntity<String> handleNacosRuntimeException(NacosRuntimeException e) {
Loggers.SRV_LOG.error("got exception. {}", e.getMessage(), ExceptionUtil.getAllExceptionMsg(e));
Loggers.SRV_LOG.error("got exception. {}", ExceptionUtil.getAllExceptionMsg(e));
return ResponseEntity.status(e.getErrCode()).body(e.getMessage());
}

Expand All @@ -66,7 +66,7 @@ public ResponseEntity<String> handleNacosRuntimeException(NacosRuntimeException
*/
@ExceptionHandler(IllegalArgumentException.class)
public ResponseEntity<String> handleParameterError(IllegalArgumentException ex) {
Loggers.SRV_LOG.error("got exception. {}", ex.getMessage(), ExceptionUtil.getAllExceptionMsg(ex));
Loggers.SRV_LOG.error("got exception. {}", ExceptionUtil.getAllExceptionMsg(ex));
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(ex.getMessage());
}

Expand All @@ -78,7 +78,7 @@ public ResponseEntity<String> handleParameterError(IllegalArgumentException ex)
*/
@ExceptionHandler(MissingServletRequestParameterException.class)
public ResponseEntity<String> handleMissingParams(MissingServletRequestParameterException ex) {
Loggers.SRV_LOG.error("got exception.", ExceptionUtil.getAllExceptionMsg(ex));
Loggers.SRV_LOG.error("got exception. {}", ExceptionUtil.getAllExceptionMsg(ex));
String name = ex.getParameterName();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Parameter '" + name + "' is missing");
}
Expand All @@ -91,7 +91,7 @@ public ResponseEntity<String> handleMissingParams(MissingServletRequestParameter
*/
@ExceptionHandler(Exception.class)
public ResponseEntity<String> handleException(Exception e) {
Loggers.SRV_LOG.error("got exception.", ExceptionUtil.getAllExceptionMsg(e));
Loggers.SRV_LOG.error("got exception. {}", ExceptionUtil.getAllExceptionMsg(e));
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ExceptionUtil.getAllExceptionMsg(e));
}
}

0 comments on commit 0e20a56

Please sign in to comment.