Skip to content

Commit

Permalink
fix: check for error code 330 in case the user's mylist is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
revam committed Jan 10, 2025
1 parent c4d3447 commit c299c67
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Shoko.Server/Providers/AniDB/HTTP/RequestMyList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ protected override Task<HttpResponse<List<ResponseMyList>>> ParseResponse(HttpRe
var mylist = doc.Descendants("mylist");
if (mylist == null)
{
var error = doc.Descendants("error").FirstOrDefault();
if (error != null)
{
var errorCode = (int)error.Attribute("value");
if (errorCode == 330) // 'mylist empty'
{
Logger.LogTrace("Mylist is empty.");
return Task.FromResult(new HttpResponse<List<ResponseMyList>> { Code = data.Code, Response = [] });
}
}

throw new UnexpectedHttpResponseException("mylist tag not found", data.Code, data.Response);
}

Expand Down

0 comments on commit c299c67

Please sign in to comment.