mirror of
https://gitlab.com/sbrl/GalleryShare.git
synced 2018-06-12 22:45:16 +00:00
Unwrap async AggregateExceptions and throw each error in turn.
This commit is contained in:
parent
0d5dcec352
commit
0926851f05
1 changed files with 17 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.ExceptionServices;
|
||||
|
||||
namespace GalleryShare
|
||||
{
|
||||
|
@ -38,7 +39,22 @@ namespace GalleryShare
|
|||
}
|
||||
|
||||
GalleryServer gserver = new GalleryServer(directory, port);
|
||||
gserver.StartSync();
|
||||
try
|
||||
{
|
||||
gserver.StartSync();
|
||||
}
|
||||
catch(AggregateException agError)
|
||||
{
|
||||
agError.Handle((error) => {
|
||||
ExceptionDispatchInfo.Capture(error).Throw();
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.Error.WriteLine("Something went very wrong O.o");
|
||||
throw;
|
||||
}
|
||||
|
||||
return 255;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue