mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-08 02:04:04 +08:00
优化异常信息
This commit is contained in:
parent
4897401d32
commit
4fd23b0417
@ -20,11 +20,13 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import xyz.playedu.common.config.UniqueNameGeneratorConfig;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableAsync
|
||||
@EnableTransactionManagement
|
||||
@ComponentScan(
|
||||
basePackages = {"xyz.playedu"},
|
||||
nameGenerator = UniqueNameGeneratorConfig.class)
|
||||
|
@ -37,11 +37,11 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class ExceptionController {
|
||||
|
||||
// @ExceptionHandler(Exception.class)
|
||||
// public JsonResponse exceptionHandler(Exception e) {
|
||||
// log.error(e.getMessage());
|
||||
// return JsonResponse.error("系统错误", 500);
|
||||
// }
|
||||
@ExceptionHandler(Exception.class)
|
||||
public JsonResponse exceptionHandler(Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return JsonResponse.error("系统错误", 500);
|
||||
}
|
||||
|
||||
@ExceptionHandler(ServiceException.class)
|
||||
public JsonResponse serviceExceptionHandler(ServiceException e) {
|
||||
@ -50,7 +50,8 @@ public class ExceptionController {
|
||||
|
||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||
public JsonResponse serviceExceptionHandler(HttpMessageNotReadableException e) {
|
||||
return JsonResponse.error("参数为空", 406);
|
||||
log.error("error", e);
|
||||
return JsonResponse.error("前端提交参数解析失败", 406);
|
||||
}
|
||||
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
|
Loading…
x
Reference in New Issue
Block a user