1
0
mirror of https://github.com/h7x4/Jisho-Study-Tool.git synced 2024-12-21 13:37:29 +01:00

Add error check for kanji search

This commit is contained in:
Oystein Kristoffer Tveit 2020-07-16 14:08:35 +02:00
parent 9633693c9b
commit e254d128a3

View File

@ -23,7 +23,8 @@ class KanjiBloc extends Bloc<KanjiEvent, KanjiState> {
try {
final _kanji = await fetchKanji(event.kanjiSearchString);
yield KanjiSearchFinished(kanji: _kanji);
if (_kanji.found) yield KanjiSearchFinished(kanji: _kanji);
else yield KanjiSearchError('Something went wrong');
} on Exception {
yield KanjiSearchError('Something went wrong');
}