runStep<T> method

Future<T> runStep<T>(
  1. String description,
  2. Future<T> action()
)

Wraps a unit of work in consistent logging and exception translation.

Implementation

Future<T> runStep<T>(String description, Future<T> Function() action) async {
  Logger.info('Running: $description...');
  try {
    return await action();
  } on BuildException {
    rethrow;
  } catch (e, s) {
    throw BuildException(
      'Failed step: "$description" ($e)',
      fix: 'Check task logs above or underlying system prerequisites.',
      originalStackTrace: s,
    );
  }
}