check for errors (e.g. <error>Banned</error>)

This commit is contained in:
Reinhard Pointner 2017-02-08 13:38:10 +08:00
parent 400b678160
commit 6b6e9d3f6b
1 changed files with 6 additions and 0 deletions

View File

@ -101,6 +101,12 @@ public class AnidbClient extends AbstractEpisodeListProvider {
// get anime page as xml
Document dom = getDocument(url);
// check for errors (e.g. <error>Banned</error>)
String error = selectString("/error", dom);
if (error != null && error.length() > 0) {
throw new IllegalStateException(String.format("%s error: %s", getName(), error));
}
// parse series info
SeriesInfo seriesInfo = new SeriesInfo(this, sortOrder, locale, anime.getId());
seriesInfo.setAliasNames(anime.getAliasNames());