checkError static method

void checkError(
  1. dynamic get(),
  2. void clear()
)

Checks the legacy two-call error protocol. On web the generated bridge passes Dart closures over the module exports.

Implementation

static void checkError(
  dynamic Function() get,
  void Function() clear,
) {
  try {
    final err = get();
    if (err is Exception) {
      clear();
      throw err;
    }
  } catch (e, st) {
    if (e is Exception) rethrow;
    _log(NitroLogLevel.verbose, 'checkError', 'error-check path threw (ignored): $e', e, st);
  }
}