Error handling improvements

This commit is contained in:
Yegor Vialov
2018-11-04 18:20:06 +02:00
parent 73b32b30a8
commit e24c47b041
3 changed files with 82 additions and 5 deletions

View File

@ -195,7 +195,12 @@ class HomeAssistant {
_connectionCompleter.complete();
}
} else if (error != null) {
eventBus.fire(ShowErrorEvent(error["errorMessage"], error["errorCode"]));
if (error is Error) {
eventBus.fire(ShowErrorEvent(error.toString(), 12));
} else {
eventBus.fire(ShowErrorEvent(error["errorMessage"], error["errorCode"]));
}
}
}