AbleCloud接口返回错误码说明
error code[3000-5000]为AbleCloud内置的帐号管理,设备管理,存储服务等返回的错误码,[5001,6000]为AbleCloud平台返回的错误码,[6001-10000]为AbleCloud内部服务返回的错误码,因此建议用户自定义服务错误码区间为(1000-2000)或者10000以上。
如果您使用AbleCloud提供的SDK进行APP或者云端Service开发,需关注[3000-5000]的错误码,具体说明如下:
使用方式
错误码放在开发框架的common包中,因此使用错误码需要引入错误码的package,如下:
import com.ablecloud.common.Errors;
// 获取错误码
int errCode = Errors.ERR_INTERNAL_ERROR.code;
// 获取错误消息
String errMsg = Errors.ERR_INTERNAL_ERROR.error;
错误码包含两个public的成员字段code和error,分别表示错误码和具体的错误消息,Errors的定义如下:
public class Errors {
public static class Error {
public int code;
public String error;
public Error(int code, String error) {
this.code = code;
this.error = error;
}
public String toString() {
return "code[" + code + "]" +
" error[" + error + "]";
}
}
public static final Error ERR_INTERNAL_ERROR = new Error(3000, "internal error");
public static final Error ERR_INVALID_HEADER = new Error(3001, "invalid header");
public static final Error ERR_INVALID_PARAM = new Error(3002, "invalid param");
// other errors
}
错误码定义
完整的错误码定义如下
请求相关常用错误码 (3000 - 3500)
| 错误码(code) |
错误消息(error) |
| 3000 |
internal error |
| 3001 |
invalid header |
| 3002 |
invalid param |
| 3003 |
not supported |
| 3004 |
not allowed |
| 3005 |
no privilege |
| 3006 |
invalid request uri |
| 3007 |
major domain not exist |
| 3008 |
sub domain not exist |
| 3009 |
service not exist |
| 3010 |
message not supported |
| 3011 |
service not available |
| 3012 |
request timeout |
| 3013 |
network error |
| 3014 |
signature timeout |
| 3015 |
invalid signature |
帐号管理相关错误码 (3501 - 3600)
| 错误码(code) |
错误消息(error) |
| 3501 |
account not exist |
| 3502 |
account already exist |
| 3503 |
invalid name |
| 3504 |
password wrong |
| 3505 |
invalid verify code |
| 3506 |
verify code timeout |
| 3507 |
invalid email address |
| 3508 |
invalid phone number |
| 3509 |
invalid account status |
绑定管理相关错误码 (3601 - 3900)
| 错误码(code) |
错误消息(error) |
| 3601 |
group not exist |
| 3602 |
group already exist |
| 3603 |
invalid group status |
| 3604 |
member not exist |
| 3605 |
member already exist |
| 3606 |
invalid member status |
| 3801 |
invalid message code |
| 3802 |
device not exist |
| 3803 |
device already exist |
| 3804 |
invalid device |
| 3805 |
bind code expires |
| 3806 |
invalid bind code |
| 3807 |
device offline |
| 3808 |
master device not exist |
| 3809 |
device is master |
| 3810 |
device is slave |
| 3811 |
device already bound |
| 3812 |
device not bound |
| 3813 |
invalid device status |
| 3814 |
device response timeout |
| 3815 |
share code not exist |
| 3816 |
invalid share code |
| 3817 |
share code expires |
| 3818 |
bind device out of validity |
| 3819 |
owner not exist |
| 3820 |
gateway not match |
| 3821 |
owner not match |
| 3822 |
device not activated |
存储服务相关错误码 (3901 - 4000)
| 错误码(code) |
错误消息(error) |
| 3901 |
file not exist |
| 3902 |
file already exist |
| 3903 |
invalid file state |
| 3904 |
file checksum error |
| 3905 |
invalid file content |
| 3920 |
class not exist |
| 3921 |
class already exist |
| 3922 |
data error |
| 3923 |
data not exist |
| 3924 |
data already exist |
| 3925 |
class mismatch |
平台相关错误码 (5001 - 5300)
| 错误码(code) |
错误消息(error) |
| 5001 |
project not exist |
| 5002 |
major domain already exist |
| 5003 |
domain format invalid |
| 5004 |
too many key pairs |
| 5005 |
service is online |
| 5006 |
version not exist |
| 5007 |
version rollback |
| 5008 |
too many version published |
| 5009 |
invalid rollback |
| 5010 |
version compatible |
| 5011 |
version not compatible |
| 5012 |
invalid major version |
| 5013 |
invalid minor version |
| 5014 |
invalid patch version |
| 5015 |
instance not exist |
| 5016 |
instance already exist |
| 5017 |
empty app file from blobstore |
| 5018 |
port already in use |
| 5019 |
port not in use |
| 5020 |
port exhausted |
| 5021 |
invalid container name |
| 5022 |
agent already registered |
| 5023 |
agent not registered yet |
| 5024 |
agent already exist |
| 5025 |
agent not exist |
| 5026 |
exceed agent capacity |
| 5027 |
can not log at ALL level |
AbleCloud内部错误码 (6001 - ~)
| 错误码(code) |
错误消息(error) |
| 6001 |
null value |
| 6002 |
invalid config |
| 6003 |
not inited |
| 6004 |
already inited |
| 6005 |
entry not dir |
| 6006 |
invalid encrypt key |
| 6007 |
entry not exist |
| 6008 |
entry already exist |
| 6009 |
iterator end |
| 6011 |
invalid version |
| 6012 |
invalid result |
| 6013 |
encode error |
| 6014 |
decode error |
| 6015 |
data type error |
| 6016 |
database not exist |
| 6017 |
partition not exist |
| 6018 |
no privilege send message |
| 6019 |
no valid endpoint |
| 6020 |
endpoint not in white list |
| 6021 |
device connection exception |
| 6022 |
invalid device message |
| 6023 |
invalid inner request |
| 6024 |
check payload length failed |
| 6025 |
decrypt message error |
| 6026 |
encrypt message error |
| 6027 |
invalid format |
| 6028 |
invalid meta name |