Updated on 2022-02-24 GMT+08:00

Methods of the NorthApiException Class

When the SDK processing is abnormal or the IoT platform fails to process an SDK request, a method of the NorthApiException class is thrown. The following describes the main methods (excluding the set method):

Method

Description

public String geterror_code()

Obtains an error code. If the SDK processing is abnormal, the SDK generates a four-digit error code. If the IoT platform fails to process an SDK request, the IoT platform generates a six-digit error code.

public String getError_desc()

Obtains the description corresponding to the error code.

public String getHttpStatusCode()

Obtains the abnormal HTTP status code.

This SDK encapsulates RESTful API using HTTP. Therefore, if an exception occurs when an RESTful API is called by the SDK, an abnormal HTTP status code is returned, such as 404 or 200.

public String getHttpReasonPhase()

Obtains the cause description (ReasonPhrase) corresponding to the abnormal HTTP status code (ReasonPhrase).

For example, if the HTTP status code is 400, the cause is "Not Found." If the HTTP status code is 200, the cause is "OK."

public String getHttpMessage()

Obtains the exception content if the IoT platform fails to process a request and the exception does not contain an error code.