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.
 
 
 
 

26 lines
916 B

  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. ErrMasterUnauthorized = newError(10002, "站长权限不足")
  11. ErrBadCode = newError(10010, "验证码错误")
  12. ErrNotInGroup = newError(10011, "用户没有在群组中")
  13. ErrGroupNotExist = newError(10013, "群组不存在")
  14. ErrDeviceNotExist = newError(10014, "设备不存在")
  15. ErrAlreadyIsFriend = newError(10015, "对方已经是好友了")
  16. ErrUserNotFound = newError(10016, "用户找不到")
  17. ErrNotIsFriend = newError(10017, "对方暂不是好友")
  18. )
  19. func newError(code int, message string) error {
  20. return status.New(codes.Code(code), message).Err()
  21. }