mac
2023-12-26 637e3152e3bfea430ca774c7dd178b4b9696c37f
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());
    }
}