mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(indexers): BTN api handle errors (#1218)
This commit is contained in:
parent
d1fa1b7cdf
commit
2372c942b3
1 changed files with 10 additions and 4 deletions
|
@ -16,9 +16,12 @@ func (c *Client) TestAPI(ctx context.Context) (bool, error) {
|
|||
return false, errors.Wrap(err, "test api userInfo failed")
|
||||
}
|
||||
|
||||
if res.Error != nil {
|
||||
return false, errors.New("btn: API test error: %s", res.Error.Message)
|
||||
}
|
||||
|
||||
var u *UserInfo
|
||||
err = res.GetObject(&u)
|
||||
if err != nil {
|
||||
if err := res.GetObject(&u); err != nil {
|
||||
return false, errors.Wrap(err, "test api get userInfo")
|
||||
}
|
||||
|
||||
|
@ -39,9 +42,12 @@ func (c *Client) GetTorrentByID(ctx context.Context, torrentID string) (*domain.
|
|||
return nil, errors.Wrap(err, "call getTorrentById failed")
|
||||
}
|
||||
|
||||
if res.Error != nil {
|
||||
return nil, errors.New("btn: getTorrentById error: %s", res.Error.Message)
|
||||
}
|
||||
|
||||
var r *domain.TorrentBasic
|
||||
err = res.GetObject(&r)
|
||||
if err != nil {
|
||||
if err := res.GetObject(&r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue