call onError when error
void onError(final Object exception) { if (exception is Error || exception is Exception) { error = exception; } }