From 14de918a79943e4961b09fa01ed320c6cad41f2e Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 28 六月 2023 17:14:51 +0800 Subject: [PATCH] Revert "Revert "Merge branch 'hxb' into wjc"" --- HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/exception/HDLLinkException.java | 67 +++++++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 0 deletions(-) diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/exception/HDLLinkException.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/exception/HDLLinkException.java new file mode 100644 index 0000000..040ff3b --- /dev/null +++ b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/exception/HDLLinkException.java @@ -0,0 +1,67 @@ +package com.hdl.sdk.link.common.exception; + +import androidx.annotation.NonNull; + +/** + * Created by Tong on 2021/11/11. + */ +public class HDLLinkException extends RuntimeException { + + private int code = 0; + private String msg = ""; + private Throwable rawThrowable; + + public HDLLinkException() { + } + + public HDLLinkException(String msg) { + this.msg = msg; + } + + public HDLLinkException(int code, String msg) { + this.code = code; + this.msg = msg; + } + + public HDLLinkException(int code) { + this.code = code; + } + + public HDLLinkException(Throwable rawThrowable) { + this.rawThrowable = rawThrowable; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public @NonNull + String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public Throwable getRawThrowable() { + return rawThrowable; + } + + public void setRawThrowable(Throwable rawThrowable) { + this.rawThrowable = rawThrowable; + } + + public static HDLLinkException getErrorWithCode(HDLLinkCode code){ + return new HDLLinkException(code.getCode(), code.getMsg()); + } + + public static HDLLinkException getErrorWithCode(int code,String msg){ + return new HDLLinkException(code,msg); + } +} + -- Gitblit v1.8.0