* error handling

This commit is contained in:
Reinhard Pointner 2011-10-18 04:10:56 +00:00
parent 8418389e77
commit 67e6dcf196
1 changed files with 6 additions and 1 deletions

View File

@ -171,8 +171,13 @@ public class ArgumentProcessor {
seriesNames = singleton(query); seriesNames = singleton(query);
} }
// fetch episode data
Set<Episode> episodes = fetchEpisodeSet(db, seriesNames, locale, strict); Set<Episode> episodes = fetchEpisodeSet(db, seriesNames, locale, strict);
if (episodes.isEmpty()) {
throw new RuntimeException("Failed to fetch episode data");
}
// similarity metrics for matching // similarity metrics for matching
SimilarityMetric[] sequence; SimilarityMetric[] sequence;
if (strict) { if (strict) {
@ -656,7 +661,7 @@ public class ArgumentProcessor {
private void printEpisodeList(String query, ExpressionFormat format, String db, Locale locale) throws Exception { private void printEpisodeList(String query, ExpressionFormat format, String db, Locale locale) throws Exception {
// find series on the web and fetch episode list // find series on the web and fetch episode list
EpisodeListProvider service = db != null ? getEpisodeListProvider(db) : TVRage; EpisodeListProvider service = (db == null) ? TVRage : getEpisodeListProvider(db);
SearchResult hit = selectSearchResult(query, service.search(query, locale), false); SearchResult hit = selectSearchResult(query, service.search(query, locale), false);
Analytics.trackEvent("CLI", "PrintEpisodeList", hit.getName()); Analytics.trackEvent("CLI", "PrintEpisodeList", hit.getName());