Commit 4f9f564c authored by 以墨为白's avatar 以墨为白 🎧

文档

parent 0e76d24b
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
......@@ -43,6 +44,16 @@ public class GlobalExceptionHandler {
return new HttpResult<>(state);
}
//请求映射问题
@ExceptionHandler(value = HttpMediaTypeNotSupportedException.class)
@ResponseBody
public HttpResult<HttpResultState> handleHttpMediaTypeNotSupportedException(HttpServletRequest req, Exception e) {
logger.error("错误信息如下:", e);
HttpResultState state = HttpResultState.NOTIFICATION;
state.setMessage(e.getMessage());
return new HttpResult<>(state);
}
//not found
@ResponseBody
@ExceptionHandler(value = {NotFoundException.class, NoHandlerFoundException.class})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment