From d8c6a7a59e78f1aa9375fe8f288a9bb33b183eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8A=9B?= Date: Fri, 14 Jan 2022 17:31:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=BC=82=E5=B8=B8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/web/exception/CustomException.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/canvas/web/exception/CustomException.java b/common/src/main/java/com/canvas/web/exception/CustomException.java index a43d42d..6ccd464 100644 --- a/common/src/main/java/com/canvas/web/exception/CustomException.java +++ b/common/src/main/java/com/canvas/web/exception/CustomException.java @@ -1,4 +1,33 @@ package com.canvas.web.exception; -public class CustomException { + +//自定义异常类 +public class CustomException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + private Integer code; + + private String message; + + public CustomException(String message) { this.message=message;} + + public CustomException(String message ,Integer code){ + this.message=message; + this.code=code; + } + + public CustomException(String message,Throwable e){ + super(message,e); + this.message=message; + } + + @Override + public String getMessage() { + return message; + } + + public Integer getCode() { + return code; + } }