code.go 396 B

1234567891011121314151617181920
  1. package codes
  2. import "github.com/go-kratos/kratos/v2/errors"
  3. func Error(code int32, msg string) error {
  4. return errors.Error(code, "", msg)
  5. }
  6. func CommonErr(msg string) error {
  7. return errors.Error(10400, "", msg)
  8. }
  9. func SystemErr(msg string) error {
  10. return errors.Error(10500, "", "")
  11. }
  12. // 自定义返回值. 如自字重定向
  13. func Customize() error {
  14. return errors.Error(-1, "", "")
  15. }