feat: update app errors
This commit is contained in:
@@ -53,10 +53,10 @@ func (s *user) LoginWithOTP(ctx context.Context, phone, otp string) (*auth_dto.L
|
||||
Gender: consts.GenderSecret, // 默认性别
|
||||
}
|
||||
if err := query.Create(u); err != nil {
|
||||
return nil, errorx.ErrDatabaseError.WithMsg("创建用户失败")
|
||||
return nil, errorx.ErrDatabaseError.WithCause(err).WithMsg("创建用户失败")
|
||||
}
|
||||
} else {
|
||||
return nil, errorx.ErrDatabaseError.WithMsg("查询用户失败")
|
||||
return nil, errorx.ErrDatabaseError.WithCause(err).WithMsg("查询用户失败")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ func (s *user) Me(ctx context.Context) (*auth_dto.User, error) {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errorx.ErrRecordNotFound
|
||||
}
|
||||
return nil, errorx.ErrDatabaseError
|
||||
return nil, errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
|
||||
return s.toAuthUserDTO(u), nil
|
||||
@@ -117,7 +117,7 @@ func (s *user) Update(ctx context.Context, form *user_dto.UserUpdate) error {
|
||||
// Birthday: form.Birthday, // 类型转换需处理
|
||||
})
|
||||
if err != nil {
|
||||
return errorx.ErrDatabaseError
|
||||
return errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -139,7 +139,7 @@ func (s *user) RealName(ctx context.Context, form *user_dto.RealNameForm) error
|
||||
// RealName: form.Realname, // 需在 user 表添加字段? payout_accounts 有 realname
|
||||
})
|
||||
if err != nil {
|
||||
return errorx.ErrDatabaseError
|
||||
return errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -160,7 +160,7 @@ func (s *user) GetNotifications(ctx context.Context, typeArg string) ([]user_dto
|
||||
|
||||
list, err := query.Order(tbl.CreatedAt.Desc()).Find()
|
||||
if err != nil {
|
||||
return nil, errorx.ErrDatabaseError
|
||||
return nil, errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
|
||||
result := make([]user_dto.Notification, len(list))
|
||||
|
||||
Reference in New Issue
Block a user