Class KiiErrorParser
A Parser for error string or error object returned by SDK.
Defined in: KiiSDK.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
KiiErrorParser.parse(error)
Parse an error string or error object returned by SDK.
|
Method Detail
<static>
{Object}
KiiErrorParser.parse(error)
Parse an error string or error object returned by SDK.
var err = KiiErrorParser.parse(errorString); var httpStatus = err.status; if (httpStatus == 0) { // NetworkError } else if (httpStatus == -1) { // Error is not related the http error. eg. argument error, illegal state error, etc. } else if (httpStatus == -2) { // Unknown error is detected. // Please confirm that you are using the latest version of SDK. } else if (httpStatus >= 400 && httpStatus < 600) { // Http error } var errorCode = err.code; var errorMessage = err.message;
- Parameters:
- {Object} error
- An error string or error object
- Returns:
- {Object} return parsed error object.