golang-im聊天
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

define.go 835 B

2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
123456789101112131415161718192021222324
  1. package gerrors
  2. import (
  3. "google.golang.org/grpc/codes"
  4. "google.golang.org/grpc/status"
  5. )
  6. var (
  7. ErrUnknown = status.New(codes.Unknown, "服务器异常").Err() // 服务器未知错误
  8. ErrUnauthorized = newError(10000, "请重新登录")
  9. ErrBadRequest = newError(10001, "请求参数错误")
  10. ErrBadCode = newError(10010, "验证码错误")
  11. ErrNotInGroup = newError(10011, "用户没有在群组中")
  12. ErrGroupNotExist = newError(10013, "群组不存在")
  13. ErrDeviceNotExist = newError(10014, "设备不存在")
  14. ErrAlreadyIsFriend = newError(10015, "对方已经是好友了")
  15. ErrUserNotFound = newError(10016, "用户找不到")
  16. ErrNotIsFriend = newError(10017, "对方暂不是好友")
  17. )
  18. func newError(code int, message string) error {
  19. return status.New(codes.Code(code), message).Err()
  20. }