45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
package Nrestful
|
|
|
|
import (
|
|
|
|
)
|
|
|
|
const ERRCODE_SUCCESS uint32 = 2001
|
|
const ERRCODE_COM_UNSUPPORT uint32 = 3001
|
|
const ERRCODE_UNKNOWN_PEER uint32 = 3011
|
|
const ERRCODE_INVALID_USER_STATUS uint32 = 4001
|
|
const ERRCODE_DEST_USER_NOT_ALLOWED uint32 = 4008
|
|
const ERRCODE_CREDIT_LIMIT uint32 = 4012
|
|
const ERRCODE_INVALID_PARAM_VALUE uint32 = 5004
|
|
const ERRCODE_MISSING_PARAM uint32 = 5005
|
|
const ERRCODE_INVALID_RECHARGE_PASSWORD uint32 = 5006
|
|
const ERRCODE_UNABLE_TO_COMPLY uint32 = 5012
|
|
const ERRCODE_USER_UNKNOWN uint32 = 5030
|
|
const MAX_ERRCODE uint32 = 5000
|
|
|
|
var restCode2StrMap = make(map[uint32]string)
|
|
|
|
func init() {
|
|
restCode2StrMap[ERRCODE_SUCCESS] = "success"
|
|
restCode2StrMap[ERRCODE_COM_UNSUPPORT] = "command unsupported"
|
|
restCode2StrMap[ERRCODE_UNKNOWN_PEER] = "unknown peer"
|
|
restCode2StrMap[ERRCODE_INVALID_USER_STATUS] = "invalid user status"
|
|
restCode2StrMap[ERRCODE_DEST_USER_NOT_ALLOWED] = "dest user not allowed"
|
|
restCode2StrMap[ERRCODE_CREDIT_LIMIT] = "credit limit"
|
|
restCode2StrMap[ERRCODE_INVALID_PARAM_VALUE] = "invalid parameter value"
|
|
restCode2StrMap[ERRCODE_MISSING_PARAM] = "missing parameter"
|
|
restCode2StrMap[ERRCODE_INVALID_RECHARGE_PASSWORD] = "invalid recharge password"
|
|
restCode2StrMap[ERRCODE_UNABLE_TO_COMPLY] = "unable to comply"
|
|
restCode2StrMap[ERRCODE_USER_UNKNOWN] = "user unknown"
|
|
}
|
|
|
|
func Rest_proxy_errcodemsg(errcode uint32) string {
|
|
errStr, ok := restCode2StrMap[errcode]
|
|
if !ok {
|
|
return "unkown"
|
|
} else {
|
|
return errStr
|
|
}
|
|
}
|
|
|