Chever John 71a2d912e2 feat: initial commit for muyu-apiserver
Go service with gateway, RPC, model layers and k8s deploy configs.

Made-with: Cursor
2026-02-28 15:29:16 +08:00

25 lines
467 B
Go

package xerr
import "fmt"
type BizError struct {
Code int `json:"code"`
Msg string `json:"msg"`
}
func (e *BizError) Error() string {
return fmt.Sprintf("code: %d, msg: %s", e.Code, e.Msg)
}
func New(code int) *BizError {
return &BizError{Code: code, Msg: ErrMsg(code)}
}
func NewMsg(code int, msg string) *BizError {
return &BizError{Code: code, Msg: msg}
}
func NewServerError(msg string) *BizError {
return &BizError{Code: ServerError, Msg: msg}
}