From 637e3152e3bfea430ca774c7dd178b4b9696c37f Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期二, 26 十二月 2023 17:11:58 +0800 Subject: [PATCH] 2023年12月26日17:11:48 --- 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