run method

  1. @override
Future<void> run()

Runs this command. Subclasses should instead override runWithOutput.

The command options are resolved before the login is required, so a usage error is reported without starting a login.

Implementation

@override
Future<void> run() async {
  try {
    await super.run();
  } on FailureException catch (e, stackTrace) {
    _processFailureException(e, stackTrace);
  } on UsageException catch (_) {
    rethrow;
  } on ExitException catch (_) {
    rethrow;
  } on Exception catch (e, stackTrace) {
    processCommonClientExceptions(logger, baseCommand, e, stackTrace);
    logger.error(
      'Error when running command `$name`',
      exception: e,
      stackTrace: stackTrace,
    );
    throw UnexpectedErrorExitException(e.toString(), e, stackTrace);
  }
}