Bug fix #358 : pdf downoad errors in CLI were crashing the rest of the loop
This commit is contained in:
parent
a0f3d44e97
commit
e0999dc9ae
@ -25,9 +25,10 @@ namespace LibationCli
|
|||||||
var downloadPdf = CreateProcessable<DownloadPdf>();
|
var downloadPdf = CreateProcessable<DownloadPdf>();
|
||||||
|
|
||||||
//Chain pdf download on DownloadDecryptBook.Completed
|
//Chain pdf download on DownloadDecryptBook.Completed
|
||||||
async void onDownloadDecryptBookCompleted(object sender, LibraryBook e)
|
void onDownloadDecryptBookCompleted(object sender, LibraryBook e)
|
||||||
{
|
{
|
||||||
await downloadPdf.TryProcessAsync(e);
|
// this is fast anyway. run as sync for easy exception catching
|
||||||
|
downloadPdf.TryProcessAsync(e).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
var downloadDecryptBook = CreateProcessable<DownloadDecryptBook>(onDownloadDecryptBookCompleted);
|
var downloadDecryptBook = CreateProcessable<DownloadDecryptBook>(onDownloadDecryptBookCompleted);
|
||||||
|
|||||||
@ -19,7 +19,17 @@ namespace LibationCli
|
|||||||
strProc.Begin += (o, e) => Console.WriteLine($"{typeof(TProcessable).Name} Begin: {e}");
|
strProc.Begin += (o, e) => Console.WriteLine($"{typeof(TProcessable).Name} Begin: {e}");
|
||||||
strProc.Completed += (o, e) => Console.WriteLine($"{typeof(TProcessable).Name} Completed: {e}");
|
strProc.Completed += (o, e) => Console.WriteLine($"{typeof(TProcessable).Name} Completed: {e}");
|
||||||
|
|
||||||
strProc.Completed += completedAction;
|
strProc.Completed += (s, e) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
completedAction?.Invoke(s, e);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error(ex, "CLI error");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return strProc;
|
return strProc;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user