Exemple #1
0
 private async Task RunActionsAsync(WaivesDocument document, CancellationToken cancellationToken = default)
 {
     foreach (var documentAction in _documentActions)
     {
         document = await documentAction(document, cancellationToken).ConfigureAwait(false);
     }
 }
Exemple #2
0
        public async Task RunAsync(Document document, CancellationToken cancellationToken = default)
        {
            WaivesDocument waivesDocument = null;

            try
            {
                waivesDocument = await _documentCreator(document, cancellationToken);
                await RunActionsAsync(waivesDocument, cancellationToken).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                _onDocumentException(e, document);
            }
            finally
            {
                if (waivesDocument != null)
                {
                    await _documentDeleter(waivesDocument);
                }
            }
        }