fix(download-clients): qbit nil logger panic (#344)

The logger wasn't set, so it was always nil. Change to always initialize and override if one is passed.
This commit is contained in:
Ludvig Lundgren 2022-07-08 22:12:19 +02:00 committed by GitHub
parent 33e3691737
commit 401c93a657
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 39 deletions

View file

@ -20,6 +20,14 @@ func (s *service) RunAction(action *domain.Action, release domain.Release) ([]st
rejections []string
)
defer func() {
if r := recover(); r != nil {
s.log.Error().Msgf("recovering from panic in run action %v error: %v", action.Name, r)
err = errors.New("panic in action: %v", action.Name)
return
}
}()
switch action.Type {
case domain.ActionTypeTest:
s.test(action.Name)