自定义异常
package com.single.bean;import org.springframework.core.NestedRuntimeException;public class FDWException extends NestedRuntimeException {private static final long serialVersionUID = 6046035491210083235L;public FDWException(String msg) {super(msg);}public FDWException(String msg, Throwable cause) {super(msg, cause);}}
无异常捕获
无异常捕获,可以看到返回值是原生的报错信息!!!
package com.single.controller;import com.single.bean.FDWException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;/*** @program: RedisDemo* @description: 异常接口* @author: fudingwei* @create: 2024-06-17 11:17**/
@Controller
@RequestMapping("/exception")
public class ExceptionCo