run method
This will initiate the request by calling action. And when the
request is done the result will be saved int _completer
.
_completer
can also have the exceptions if occured.
Implementation
Future<void> run() async {
tries += 1;
try {
var result = await action();
_completer.complete(result);
} catch (exception, stackTrace) {
if (exception is Error) {
_logger.fatal(
'${Constants.fatalError} ($exception).',
);
return _completer.completeError(exception, stackTrace);
}
_logger.warning(
Constants.fibreErrorOccurred,
);
return _completer.completeError(exception);
}
}