fix: add missing span.SetStatus(codes.Error) (#86)
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: twhelp/core#86
This commit is contained in:
Dawid Wysokiński 2022-09-18 10:02:42 +00:00
parent 7415d32923
commit 4f96cdf202
4 changed files with 6 additions and 0 deletions

View File

@ -88,6 +88,7 @@ func (e *Ennoblement) Refresh(ctx context.Context, key, url string) error {
}
if err := e.repo.Create(ctx, params...); err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return fmt.Errorf("EnnoblementRepository.Create: %w", err)
}
}

View File

@ -90,6 +90,7 @@ func (p *Player) createOrUpdate(ctx context.Context, key string, players []domai
}
if err := p.repo.CreateOrUpdate(ctx, params...); err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return fmt.Errorf("PlayerRepository.CreateOrUpdate: %w", err)
}
}
@ -126,6 +127,7 @@ func (p *Player) delete(ctx context.Context, key string, existing []domain.BaseP
})
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return fmt.Errorf("PlayerRepository.List: %w", err)
}

View File

@ -91,6 +91,7 @@ func (t *Tribe) createOrUpdate(ctx context.Context, key string, tribes []domain.
}
if err := t.repo.CreateOrUpdate(ctx, params...); err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return fmt.Errorf("TribeRepository.CreateOrUpdate: %w", err)
}
}
@ -127,6 +128,7 @@ func (t *Tribe) delete(ctx context.Context, key string, existing []domain.BaseTr
})
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return fmt.Errorf("TribeRepository.List: %w", err)
}

View File

@ -78,6 +78,7 @@ func (v *Village) Refresh(ctx context.Context, key, url string) (domain.RefreshV
}
if err := v.repo.CreateOrUpdate(ctx, params...); err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return domain.RefreshVillagesResult{}, fmt.Errorf("VillageRepository.CreateOrUpdate: %w", err)
}
}