| | |
| | | import com.hdl.hdlhttp.HxHttpConfig; |
| | | import com.hdl.hdlhttp.callback.HxException; |
| | | import com.hdl.linkpm.sdk.R; |
| | | import com.hdl.linkpm.sdk.core.response.BaseInfo; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | |
| | | private Throwable rawThrowable; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | private BaseInfo.Extra mExtra; |
| | | |
| | | @Retention(RetentionPolicy.SOURCE) |
| | | @Target({ElementType.FIELD, ElementType.PARAMETER}) |
| | |
| | | } |
| | | } |
| | | |
| | | public BaseInfo.Extra getmExtra() { |
| | | return mExtra; |
| | | } |
| | | |
| | | public void setExtra(BaseInfo.Extra mExtra) { |
| | | this.mExtra = mExtra; |
| | | } |
| | | |
| | | public HDLException(int code, String msg, BaseInfo.Extra extra) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | if (extra != null) { |
| | | this.mExtra = extra; |
| | | } |
| | | if (!TextUtils.isEmpty(msg)) { |
| | | this.msg = msg; |
| | | } else { |
| | | this.msg = HxHttpConfig.getInstance().getString(com.hdl.hdlhttp.R.string.network_error); |
| | | } |
| | | } |
| | | |
| | | |
| | | public boolean isNetError() { |
| | | return getCode() < 0; |
| | | } |
| | |
| | | public static HDLException getErrorWithCode(HDLErrorCode code) { |
| | | return new HDLException(code.getCode(), code.getMsg()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |