New file |
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | |
|