safeUpdateOrThrow<T> static method

T safeUpdateOrThrow<T>(
  1. T update()
)

Execute a function safely, throwing if error occurs

Implementation

static T safeUpdateOrThrow<T>(T Function() update) {
  try {
    return update();
  } catch (e, stackTrace) {
    Logger.error('State update error (throwing)', e);
    Logger.debug('Stack trace', stackTrace);
    rethrow;
  }
}