12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package main
- var (
- errMsg map[int]string
- )
- const (
- OK = iota
- TIME_OUT
- NO_RESP
- NO_AUTH
- FORMAT_ERR
- SERVER_BUSY
- ILLEGAL_REQ
- INNER_ERR
- ILLEGAL_PARM
- INIT_DRIVER_ERR
- UNKNOWN_ERR
- )
- func init() {
- errMsg = make(map[int]string)
- errMsg[0] = "成功"
- errMsg[1] = "网络超时"
- errMsg[2] = "无响应"
- errMsg[3] = "无权限"
- errMsg[4] = "格式错误"
- errMsg[5] = "服务繁忙"
- errMsg[6] = "非法请求"
- errMsg[7] = "内部错误"
- errMsg[8] = "不合法的数据,或者amount 小于等于17500"
- errMsg[9] = "init driver error"
- //errMsg[8] = "requesting transactions at unknown confirmation heights"
- }
- func GetErrMsg(ret int, data []byte) string {
- msg, ok := errMsg[ret]
- if ok {
- return msg
- }
- return string(data)
- }
|