tencent-im/internal/core/error.go

39 lines
513 B
Go
Raw Permalink Normal View History

2022-09-27 11:31:23 +08:00
/**
* @Author: Echo
* @Email:1711788888@qq.com
* @Date: 2021/8/27 1:12 下午
* @Desc: TODO
*/
package core
type Error interface {
error
Code() int
Message() string
}
type respError struct {
code int
message string
}
func NewError(code int, message string) Error {
return &respError{
code: code,
message: message,
}
}
func (e *respError) Error() string {
return e.message
}
func (e *respError) Code() int {
return e.code
}
func (e *respError) Message() string {
return e.message
}