init: 通用库抽离——httpx/logger/wsc/wscclient/jwtx(合并分叉副本); 顶层包布局; module path git.zeroonesoft.cn/golib/zogo
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package httpx
|
||||
|
||||
import "fmt"
|
||||
|
||||
// CodeMsg 包含 code 与 msg 的错误结构,实现了 error 接口。
|
||||
type CodeMsg struct {
|
||||
Code int
|
||||
Msg string
|
||||
}
|
||||
|
||||
func (c *CodeMsg) Error() string {
|
||||
return fmt.Sprintf("code: %d, msg: %s", c.Code, c.Msg)
|
||||
}
|
||||
|
||||
// New 创建一个 CodeMsg 错误。
|
||||
func New(code int, msg string) error {
|
||||
return &CodeMsg{Code: code, Msg: msg}
|
||||
}
|
||||
Reference in New Issue
Block a user