- add callback sign check.

This commit is contained in:
gazebo
2018-06-19 18:41:58 +08:00
parent 143a929c8c
commit 27919a36fc
11 changed files with 324 additions and 95 deletions

38
utils/errorwithcode.go Normal file
View File

@@ -0,0 +1,38 @@
package utils
import (
"fmt"
)
type ErrorWithCode struct {
str string
code string
intCode int
}
func NewErrorCode(err, code string) *ErrorWithCode {
return &ErrorWithCode{
str: err,
code: code,
intCode: Str2Int(code),
}
}
func NewErrorIntCode(err string, code int) *ErrorWithCode {
return &ErrorWithCode{
str: err,
code: Int2Str(code),
intCode: code,
}
}
func (e *ErrorWithCode) Error() string {
return fmt.Sprintf("%s, code:%s", e.str, e.code)
}
func (e *ErrorWithCode) Code() string {
return e.code
}
func (e *ErrorWithCode) IntCode() int {
return e.intCode
}