HristoKolev / TvDbSharper

TvDbSharper is fully featured modern REST client for the TheTVDB API v4
MIT License
29 stars 17 forks source link

Unable to Fetch Series Data (if show is in fact empty), data.season=null #16

Closed Baine closed 4 years ago

Baine commented 4 years ago

we've got TvDbSharper as helper module to retrieve information about (Anime-)Series from TVDB.

slim version of the code:

    public static class TvDBApiHelper
    {
        private static readonly ITvDbClient client;
        static TvDBApiHelper()
        {
            client=new TvDbClient();
            client.BaseUrl = "https://api-beta.thetvdb.com";
        }

        await client.Authentication.AuthenticateAsync(Constants.TvDB.apiKey);
        var response = await client.Series.GetAsync(seriesID);
   }

while testing i selected a show without any data by mistake (https://www.thetvdb.com/series/digimon-adventure) , causing the following error to be thrown:

Error|ExecutionContext.Run => ExecutionContext.RunInternal => <GetSeriesInfoOnlineAsync>d__7.MoveNext Error in TvDBApiHelper.GetSeriesInfoOnline: Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Int32'. Path 'data.season', line 1, position 77. ---> System.InvalidCastException: Null object cannot be converted to a value type.

maybe there's a better way to handle this? (like nullable int or something similar)

HristoKolev commented 4 years ago

Yes, this is a bug. Will be releasing bug fix soon.

HristoKolev commented 4 years ago

Fixed in 3.0.1. Please, create a new issue if you find something else. :)

Baine commented 4 years ago

thank you :) will do if i should find anything

Am Di., 14. Jan. 2020 um 18:35 Uhr schrieb Hristo Kolev < notifications@github.com>:

Closed #16 https://github.com/HristoKolev/TvDbSharper/issues/16.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HristoKolev/TvDbSharper/issues/16?email_source=notifications&email_token=ABSDERIDGCE6AKZ3VCNDKLTQ5XZVZA5CNFSM4KFLXE3KYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOV63MYEQ#event-2947992594, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSDERIMJHCTHU7CNRQ2AJLQ5XZVZANCNFSM4KFLXE3A .