From a6c0ac0f20d1d91fbe1fe591a6a9ca46f82399f5 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期五, 23 二月 2024 16:37:16 +0800 Subject: [PATCH] 使用新的依赖库的名称 --- HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLException.java | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLException.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLException.java index 0673d87..9a9b3e9 100644 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLException.java +++ b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLException.java @@ -8,6 +8,7 @@ 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; @@ -22,6 +23,8 @@ private Throwable rawThrowable; private int code; private String msg; + + private BaseInfo.Extra mExtra; @Retention(RetentionPolicy.SOURCE) @Target({ElementType.FIELD, ElementType.PARAMETER}) @@ -85,6 +88,28 @@ } } + 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; } @@ -132,6 +157,7 @@ public static HDLException getErrorWithCode(HDLErrorCode code) { return new HDLException(code.getCode(), code.getMsg()); } + } -- Gitblit v1.8.0