BusinessException
public class BusinessException extends RuntimeException {
private static final long serialVersionUID = 2218515841497670864 L;
private Long code;
protected Object data;
public BusinessException ( ) {
this ( "操作失败!" ) ;
}
public BusinessException ( String message) {
super ( message) ;
this . code = 4000 L;
}
public BusinessException ( String message, Long code) {
super ( message) ;
this . code = code;
}
public BusinessException ( String message, Throwable cause) {
super ( message, cause) ;
this . code = 4000 L;
}
public BusinessException ( Throwable cause) {
super ( cause) ;
this . code = 4000 L;
}
public BusinessException ( String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super ( message, cause, enableSuppression, writableStackTrace) ;
this . code = 4000 L;
}
public Long getCode ( ) {
return this . code;
}
public BusinessException setCode ( Long code) {
this . code = code;
return this ;
}
public BusinessException withData ( String key, Object value) {
if ( this . data == null) {
this . data = new HashMap ( ) ;
}
( ( Map) this . data) . put ( key, value) ;
return this ;
}
public BusinessException withData ( Map< String, Object> values) {
if ( values == null) {
return this ;
} else {
if ( this . data == null) {
this . data = new HashMap ( ) ;
}
( ( Map) this . data) . putAll ( values) ;
return this ;
}
}
public BusinessException setData ( Object data) {
this . data = data;
return this ;
}
public Object getData ( ) {
return this . data;
}
}
throw new BusinessException ( "附件上传服务器失败" ) ;