目录

class info
com.huawei.hms.mlsdk.common.MLException
异常状态处理类,封装了MLKit的各种异常状态码。

Constant Summary

TypeNameDesc
intUNKNOWN-1:未知类型错误。
intSUCCESS0:服务正常运行。
intDISCARDED1:操作被取消。
intINNER2:内部错误。
intINACTIVE3:当前服务不可用。
intNOT_SUPPORTED4:不支持的操作,可能是接口未实现或当前版本不支持。
intILLEGAL_PARAMETER5:错误参数,表示参数本身错误,与服务无关。
intOVERDUE6:操作超时,在设定的截止时间之前,操作未完成。
intNO_FOUND7:请求的资源未发现或不存在。
intDUPLICATE_FOUND8:想要创建的资源已经存在,不需要重复创建。
intNO_PERMISSION9:没有权限操作。
intINSUFFICIENT_RESOURCE10:资源耗尽,可能是系统资源或当前用户的资源不足。
intANALYSIS_FAILURE11:由于系统未准备就绪,导致操作失败。
intINTERRUPTED12:操作被打断,可能是并发导致中止。
intEXCEED_RANGE13:跨界限操作,试图请求有效范围外的操作。
intDATA_MISSING14:不可恢复的数据损坏或丢失。
intAUTHENTICATION_REQUIRED15:请求未经过有效身份认证。
intTFLITE_NOT_COMPATIBLE16:下载的模型与正在运行的模型不兼容。
intINSUFFICIENT_SPACE17:磁盘空间不足。
intHASH_MISS18:下载模型的哈希值与真实值不符。

Public Constructor Summary

Constructor name
MLException(String message, int code)
根据异常信息和异常码获取异常状态码类的实例。
MLException(String message, int code, Throwable innerException)
根据异常信息、异常码和捕获的上层异常获取异常状态码类的实例。

Public Method Summary

Return typeMethod name
intgetCode()

Constants

Constant
public static final int UNKNOWN
-1:未知类型错误。
Constant Value: -1。
Constant
public static final int SUCCESS
0:服务正常运行。
Constant Value: 0。
Constant
public static final int DISCARDED
1:操作被取消。
Constant Value: 1。
Constant
public static final int INNER
2:内部错误。
Constant Value: 2。
Constant
public static final int INACTIVE
3:当前服务不可用。
Constant Value: 3。
Constant
public static final int NOT_SUPPORTED
4:不支持的操作,可能是接口未实现或当前版本不支持。
Constant Value: 4。
Constant
public static final int ILLEGAL_PARAMETER
5:错误参数,表示参数本身错误,与服务无关。
Constant Value: 5。
Constant
public static final int OVERDUE
6:操作超时,在设定的截止时间之前,操作未完成。
Constant Value: 6。
Constant
public static final int NO_FOUND
7:请求的资源未发现或不存在。
Constant Value: 7。
Constant
public static final int DUPLICATE_FOUND
8:想要创建的资源已经存在,不需要重复创建。
Constant Value: 8。
Constant
public static final int NO_PERMISSION
9:没有权限操作。
Constant Value: 9。
Constant
public static final int INSUFFICIENT_RESOURCE
10:资源耗尽,可能是系统资源或当前用户的资源不足。
Constant Value: 10。
Constant
public static final int ANALYSIS_FAILURE
11:由于系统未准备就绪,导致操作失败。
Constant Value: 11。
Constant
public static final int INTERRUPTED
12:操作被打断,可能是并发导致中止。
Constant Value: 12。
Constant
public static final int EXCEED_RANGE
13:跨界限操作,试图请求有效范围外的操作。
Constant Value: 13。
Constant
public static final int DATA_MISSING
14:不可恢复的数据损坏或丢失。
Constant Value: 14。
Constant
public static final int AUTHENTICATION_REQUIRED
15:请求未经过有效身份认证。
Constant Value: 15。
Constant
public static final int TFLITE_NOT_COMPATIBLE
16:下载的模型与正在运行的模型不兼容。
Constant Value: 16。
Constant
public static final int INSUFFICIENT_SPACE
17:磁盘空间不足。
Constant Value: 17。
Constant
public static final int HASH_MISS
18:下载模型的哈希值与真实值不符。
Constant Value: 18。

Public Constructors

Method
public MLException(String message, int code)
根据异常信息和异常码获取异常状态码类的实例。

Parameters

Parameter nameParameter desc
message异常信息
code异常码
Method
public MLException(String message, int code, Throwable innerException)
根据异常信息、异常码和捕获的上层异常获取异常状态码类的实例。

Parameters

Parameter nameParameter desc
message异常信息
code异常码
innerException捕获的上层异常信息。

Public Methods

Method
public int getCode()
获取异常码。

Return

Typedesc
int返回异常码。