run method

void run(
  1. DartBlockArbiter arbiter
)

Implementation

void run(DartBlockArbiter arbiter) {
  try {
    _execute(arbiter);
  } on DartBlockException catch (neoTechException) {
    neoTechException.statement ??= this;
    rethrow;
  } on ReturnStatementException {
    /// Do not do anything here!! ReturnStatementException is a very special
    /// type used to propagate a return value in a function's body.
    rethrow;
  } on Exception catch (ex) {
    // A common Dart Exception not known by NeoTech.
    throw DartBlockException.fromException(exception: ex, statement: this);
  } on StackOverflowError catch (_) {
    // Thrown by Dart in case of faulty recursive function call
    throw DartBlockException(
      title: "Stack Overflow",
      message:
          "The program was killed due to a stack overflow error. This can occur if you have a recursive function without an appropriate ending condition.",
      statement: this,
    );
  } on Error catch (err) {
    // Very general error thrown by Dart
    if (kDebugMode) {
      print(err);
    }
    throw DartBlockException(
      title: "Critical Error",
      message:
          "The program was killed due to an unknown error. Ensure your program does not contain an infinite loop or a recursive function without an ending condition!",
      statement: this,
    );
  }
}