Skip to content

Commit

Permalink
Propagate exceptions to caller, per #6.
Browse files Browse the repository at this point in the history
  • Loading branch information
cerebrate committed May 1, 2020
1 parent fb11cd5 commit 2ac53f5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Arkane.Zeroconf/Providers/Bonjour/ServiceBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System ;
using System.Collections ;
using System.Collections.Generic ;
using System.Diagnostics ;
using System.Threading.Tasks ;

#endregion
Expand Down Expand Up @@ -79,7 +80,15 @@ private void Start (bool async)
throw new InvalidOperationException ("ServiceBrowser is already started") ;

if (async)
this.task = Task.Run (() => this.ProcessStart ()).ContinueWith (_ => this.task = null) ;
this.task = Task.Run (() => this.ProcessStart ()).ContinueWith (_ =>
{
this.task = null ;
if (_.IsFaulted)
{
Debug.Assert (_.Exception != null, "_.Exception != null") ;
throw _.Exception ;
}
}) ;
else
this.ProcessStart () ;
}
Expand Down

0 comments on commit 2ac53f5

Please sign in to comment.