handleException method

Future<RetryAction> handleException(
  1. NodeSpec action,
  2. ActionContext context,
  3. Object e
)

Exception handling when executing an action

Implementation

Future<RetryAction> handleException(
    NodeSpec action, ActionContext context, Object e) async {
  if (e is SolutionException) {
    showErrorMessage(e.message);
  } else if (e is http.ClientException ||
      e is SocketException ||
      e is WebSocketException) {
    final title =
        Lowder.editorMode ? e.toString() : "communication_error_message";
    if (await widgets.showConfirmation(
        title: title, message: "try_again_question")) {
      return RetryAction(true);
    }
  } else if (Lowder.editorMode) {
    showErrorMessage(e.toString());
  } else {
    showErrorMessage("unknown_error_message");
  }
  return RetryAction(false);
}