feat: update app errors

This commit is contained in:
2025-12-29 14:54:05 +08:00
parent 8fa3d18a9c
commit 8c4bc55f45
9 changed files with 86 additions and 55 deletions

View File

@@ -36,7 +36,7 @@ func (s *tenant) GetPublicProfile(ctx context.Context, id string) (*tenant_dto.T
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, errorx.ErrRecordNotFound
}
return nil, errorx.ErrDatabaseError
return nil, errorx.ErrDatabaseError.WithCause(err)
}
// Stats
@@ -106,7 +106,7 @@ func (s *tenant) Follow(ctx context.Context, id string) error {
}
if err := models.TenantUserQuery.WithContext(ctx).Create(tu); err != nil {
return errorx.ErrDatabaseError
return errorx.ErrDatabaseError.WithCause(err)
}
return nil
}
@@ -121,7 +121,7 @@ func (s *tenant) Unfollow(ctx context.Context, id string) error {
_, err := models.TenantUserQuery.WithContext(ctx).Where(models.TenantUserQuery.TenantID.Eq(tid), models.TenantUserQuery.UserID.Eq(uid)).Delete()
if err != nil {
return errorx.ErrDatabaseError
return errorx.ErrDatabaseError.WithCause(err)
}
return nil
}
}