feat(actions): improve errors and logs (#340)

This commit is contained in:
Ludvig Lundgren 2022-07-07 16:28:14 +02:00 committed by GitHub
parent 31fbe013ff
commit 402596523d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 315 additions and 418 deletions

View file

@ -9,7 +9,7 @@ import (
"github.com/autobrr/autobrr/pkg/sonarr"
)
func (s *service) sonarr(release domain.Release, action domain.Action) ([]string, error) {
func (s *service) sonarr(action domain.Action, release domain.Release) ([]string, error) {
s.log.Trace().Msg("action SONARR")
// TODO validate data
@ -17,7 +17,6 @@ func (s *service) sonarr(release domain.Release, action domain.Action) ([]string
// get client for action
client, err := s.clientSvc.FindByID(context.TODO(), action.ClientID)
if err != nil {
s.log.Error().Err(err).Msgf("sonarr: error finding client: %v", action.ClientID)
return nil, errors.Wrap(err, "sonarr could not find client: %v", action.ClientID)
}
@ -54,8 +53,7 @@ func (s *service) sonarr(release domain.Release, action domain.Action) ([]string
rejections, err := arr.Push(r)
if err != nil {
s.log.Error().Stack().Err(err).Msgf("sonarr: failed to push release: %v", r)
return nil, err
return nil, errors.Wrap(err, "sonarr: failed to push release: %v", r)
}
if rejections != nil {