ソースを参照

新增常用两个codes

dcsunny 4 年 前
コミット
9a03130093
1 ファイル変更10 行追加1 行削除
  1. 10 1
      codes/code.go

+ 10 - 1
codes/code.go

@@ -2,10 +2,19 @@ package codes
 
 import "github.com/go-kratos/kratos/v2/errors"
 
-func SystemErr() error {
+func Error(code int32, msg string) error {
+	return errors.Error(code, "", msg)
+}
+
+func CommonErr(msg string) error {
+	return errors.Error(10400, "", msg)
+}
+
+func SystemErr(msg string) error {
 	return errors.Error(10500, "", "")
 }
 
+// 自定义返回值. 如自字重定向
 func Customize() error {
 	return errors.Error(-1, "", "")
 }