|
|
@ -1,6 +1,6 @@
|
|
|
|
package com.github.dynamic.threadpool.common.web.base;
|
|
|
|
package com.github.dynamic.threadpool.common.web.base;
|
|
|
|
|
|
|
|
|
|
|
|
import com.github.dynamic.threadpool.common.web.exception.ErrorCode;
|
|
|
|
import com.github.dynamic.threadpool.common.web.exception.ErrorCodeEnum;
|
|
|
|
import com.github.dynamic.threadpool.common.web.exception.ServiceException;
|
|
|
|
import com.github.dynamic.threadpool.common.web.exception.ServiceException;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -23,7 +23,7 @@ public final class Results {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static <T> Result<T> failure(ServiceException serviceException) {
|
|
|
|
public static <T> Result<T> failure(ServiceException serviceException) {
|
|
|
|
return new Result<T>().setCode(ErrorCode.SERVICE_ERROR.getCode())
|
|
|
|
return new Result<T>().setCode(ErrorCodeEnum.SERVICE_ERROR.getCode())
|
|
|
|
.setMessage(serviceException.getMessage());
|
|
|
|
.setMessage(serviceException.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -33,4 +33,10 @@ public final class Results {
|
|
|
|
.setMessage(message);
|
|
|
|
.setMessage(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static <T> Result<T> failure(ErrorCodeEnum errorCode) {
|
|
|
|
|
|
|
|
return new Result<T>()
|
|
|
|
|
|
|
|
.setCode(errorCode.getCode())
|
|
|
|
|
|
|
|
.setMessage(errorCode.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|