bugfix:BaseException异常没有正确在前端输出,原因是全局异常处理时抛出的是message,而非defaultMessage,考虑到这里并没有使用,所以直接移除defaultMessage。

优化:其他几个类的message字段命名统一。
pull/18/head
zhengwangeng 5 years ago
parent d42a6751e3
commit aed75bcef4

@ -24,17 +24,12 @@ public class BaseException extends RuntimeException
*/ */
private Object[] args; private Object[] args;
/** public BaseException(String module, String code, Object[] args, String message)
*
*/
private String defaultMessage;
public BaseException(String module, String code, Object[] args, String defaultMessage)
{ {
super(message);
this.module = module; this.module = module;
this.code = code; this.code = code;
this.args = args; this.args = args;
this.defaultMessage = defaultMessage;
} }
public BaseException(String module, String code, Object[] args) public BaseException(String module, String code, Object[] args)
@ -42,9 +37,9 @@ public class BaseException extends RuntimeException
this(module, code, args, null); this(module, code, args, null);
} }
public BaseException(String module, String defaultMessage) public BaseException(String module, String message)
{ {
this(module, null, null, defaultMessage); this(module, null, null, message);
} }
public BaseException(String code, Object[] args) public BaseException(String code, Object[] args)
@ -52,9 +47,9 @@ public class BaseException extends RuntimeException
this(null, code, args, null); this(null, code, args, null);
} }
public BaseException(String defaultMessage) public BaseException(String message)
{ {
this(null, null, null, defaultMessage); this(null, null, null, message);
} }
public String getModule() public String getModule()
@ -71,9 +66,4 @@ public class BaseException extends RuntimeException
{ {
return args; return args;
} }
public String getDefaultMessage()
{
return defaultMessage;
}
} }

@ -9,8 +9,8 @@ public class CaptchaException extends RuntimeException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public CaptchaException(String msg) public CaptchaException(String message)
{ {
super(msg); super(message);
} }
} }

@ -11,29 +11,26 @@ public class CustomException extends RuntimeException
private Integer code; private Integer code;
private String message;
public CustomException(String message) public CustomException(String message)
{ {
this.message = message; super(message);
} }
public CustomException(String message, Integer code) public CustomException(Integer code, String message)
{ {
this.message = message; super(message);
this.code = code; this.code = code;
} }
public CustomException(String message, Throwable e) public CustomException(Integer code, String message, Throwable e)
{ {
super(message, e); super(message, e);
this.message = message; this.code = code;
} }
@Override public CustomException(String message, Throwable e)
public String getMessage()
{ {
return message; super(message, e);
} }
public Integer getCode() public Integer getCode()

@ -11,14 +11,14 @@ public class TaskException extends Exception
private Code code; private Code code;
public TaskException(String msg, Code code) public TaskException(String message, Code code)
{ {
this(msg, code, null); this(message, code, null);
} }
public TaskException(String msg, Code code, Exception nestedEx) public TaskException(String message, Code code, Exception nestedEx)
{ {
super(msg, nestedEx); super(message, nestedEx);
this.code = code; this.code = code;
} }

Loading…
Cancel
Save