executeVerb method

  1. @override
Future<String> executeVerb(
  1. VerbBuilder builder, {
  2. bool? sync = false,
})

Executes the command returned by VerbBuilder build command on a remote secondary server. Optionally privateKey is passed for verb builders which require authentication.

Implementation

@override
Future<String> executeVerb(VerbBuilder builder, {sync = false}) async {
  try {
    String verbResult;
    logger.finer(logger.getLogMessageWithClientParticulars(
        _preference.atClientParticulars,
        'Command sent to server: ${builder.buildCommand()}'));
    verbResult = await atLookUp.executeVerb(builder);
    logger.finer(logger.getLogMessageWithClientParticulars(
        _preference.atClientParticulars,
        'Response from server: $verbResult'));
    return verbResult;
  } on AtException catch (e) {
    throw e
      ..stack(AtChainedException(_getIntent(builder),
          ExceptionScenario.remoteVerbExecutionFailed, e.message));
  } on AtLookUpException catch (e) {
    var exception = AtExceptionUtils.get(e.errorCode!, e.errorMessage!);
    throw exception
      ..stack(AtChainedException(_getIntent(builder),
          ExceptionScenario.remoteVerbExecutionFailed, exception.message));
  }
}