Fribb / anime-lists-generator

generator for the anime-lists project
8 stars 2 forks source link

Generator Fails with JSONException when the response is a 504 Gateway Timeout #3

Closed Fribb closed 3 months ago

Fribb commented 3 months ago

The last automated run, the Response for finding TheMovieDB ID with the TheTVDB ID 79033 resulted in an Exception:

Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]

Apparently, when there is a 504 Gateway timeout error, there is something returned that isn't a JSON Object.

This needs to be handled separately to not let the whole generation process fail.

Fribb commented 3 months ago

On second thought, this should be fine and a preventative measure to remove listings when there is an issue with the TheMovieDB API.

The reason why this error happened anyway was because the TMDB API returned a 504 Gateway timeout error. This would mean that the API wasn't accessible at that time anyway. This would also mean that the following requests to TMDB might/would run into the same error preventing the lookup from those instances. Depending on how severe this issue is, this could prevent a lot of listings from the TMDB lookup and being filled.

That would mean that the items could/would remove a lot of data. But since the error completely stopped the update, nothing was really lost and the generator just needed to be restarted.