This is an automated email from the ASF dual-hosted git repository.

blankensteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-dotpulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b1eaf6  Eat errors in SetupChannel (#52)
7b1eaf6 is described below

commit 7b1eaf62ddbd432367bd6601a3593df7c33d7bf6
Author: lee_chrisbell <lee.chrisb...@gmail.com>
AuthorDate: Wed Sep 2 09:32:33 2020 -0400

    Eat errors in SetupChannel (#52)
    
    * SetupChannel needs to eat its errors.  Callers cannot catch exceptions 
from async void methods.
    
    * PR suggestions.
    
    Co-authored-by: Christopher Bell <christopher.b...@stretto.com>
---
 src/DotPulsar/Internal/ConsumerProcess.cs | 11 +++++++++--
 src/DotPulsar/Internal/ProducerProcess.cs | 11 +++++++++--
 src/DotPulsar/Internal/ReaderProcess.cs   | 11 +++++++++--
 3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/src/DotPulsar/Internal/ConsumerProcess.cs 
b/src/DotPulsar/Internal/ConsumerProcess.cs
index 449aedb..a078146 100644
--- a/src/DotPulsar/Internal/ConsumerProcess.cs
+++ b/src/DotPulsar/Internal/ConsumerProcess.cs
@@ -84,8 +84,15 @@ namespace DotPulsar.Internal
 
         private async void SetupChannel()
         {
-            var channel = await 
_factory.Create(CancellationTokenSource.Token).ConfigureAwait(false);
-            await _consumer.SetChannel(channel).ConfigureAwait(false);
+            try
+            {
+                var channel = await 
_factory.Create(CancellationTokenSource.Token).ConfigureAwait(false);
+                await _consumer.SetChannel(channel).ConfigureAwait(false);
+            }
+            catch
+            {
+                // ignored
+            }
         }
     }
 }
diff --git a/src/DotPulsar/Internal/ProducerProcess.cs 
b/src/DotPulsar/Internal/ProducerProcess.cs
index fad638a..81861e3 100644
--- a/src/DotPulsar/Internal/ProducerProcess.cs
+++ b/src/DotPulsar/Internal/ProducerProcess.cs
@@ -68,8 +68,15 @@ namespace DotPulsar.Internal
 
         private async void SetupChannel()
         {
-            var channel = await 
_factory.Create(CancellationTokenSource.Token).ConfigureAwait(false);
-            await _producer.SetChannel(channel).ConfigureAwait(false);
+            try
+            {
+                var channel = await 
_factory.Create(CancellationTokenSource.Token).ConfigureAwait(false);
+                await _producer.SetChannel(channel).ConfigureAwait(false);
+            }
+            catch
+            {
+                // ignored
+            }
         }
     }
 }
diff --git a/src/DotPulsar/Internal/ReaderProcess.cs 
b/src/DotPulsar/Internal/ReaderProcess.cs
index 9b9a438..67763c5 100644
--- a/src/DotPulsar/Internal/ReaderProcess.cs
+++ b/src/DotPulsar/Internal/ReaderProcess.cs
@@ -71,8 +71,15 @@ namespace DotPulsar.Internal
 
         private async void SetupChannel()
         {
-            var channel = await 
_factory.Create(CancellationTokenSource.Token).ConfigureAwait(false);
-            await _reader.SetChannel(channel).ConfigureAwait(false);
+            try
+            {
+                var channel = await 
_factory.Create(CancellationTokenSource.Token).ConfigureAwait(false);
+                await _reader.SetChannel(channel).ConfigureAwait(false);
+            }
+            catch
+            {
+                // ignored
+            }
         }
     }
 }

Reply via email to