Bug fix #364 - app was crashing on attempt to download PDF to which the user no longer had ownership. Eg: returned or Plus catalog
This commit is contained in:
parent
f05465b29b
commit
f310d583d8
@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>8.4.3.1</Version>
|
<Version>8.4.4.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Octokit" Version="2.0.0" />
|
<PackageReference Include="Octokit" Version="2.0.0" />
|
||||||
|
|||||||
@ -32,6 +32,15 @@ namespace FileLiberator
|
|||||||
|
|
||||||
libraryBook.Book.UpdatePdfStatus(result.IsSuccess ? LiberatedStatus.Liberated : LiberatedStatus.NotLiberated);
|
libraryBook.Book.UpdatePdfStatus(result.IsSuccess ? LiberatedStatus.Liberated : LiberatedStatus.NotLiberated);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error(ex, "Error downloading PDF");
|
||||||
|
|
||||||
|
var result = new StatusHandler();
|
||||||
|
result.AddError($"Error downloading PDF. See log for details. Error summary: {ex.Message}");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using Avalonia.Media;
|
|||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
using DataLayer;
|
using DataLayer;
|
||||||
using Dinah.Core;
|
using Dinah.Core;
|
||||||
|
using Dinah.Core.ErrorHandling;
|
||||||
using FileLiberator;
|
using FileLiberator;
|
||||||
using LibationFileManager;
|
using LibationFileManager;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
@ -289,11 +290,27 @@ namespace LibationAvalonia.ViewModels
|
|||||||
Logger.Info($"{((Processable)sender).Name} Step, Completed: {libraryBook.Book}");
|
Logger.Info($"{((Processable)sender).Name} Step, Completed: {libraryBook.Book}");
|
||||||
UnlinkProcessable((Processable)sender);
|
UnlinkProcessable((Processable)sender);
|
||||||
|
|
||||||
if (Processes.Count > 0)
|
if (Processes.Count == 0)
|
||||||
{
|
{
|
||||||
|
Completed?.Invoke(this, EventArgs.Empty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NextProcessable();
|
NextProcessable();
|
||||||
LinkProcessable(CurrentProcessable);
|
LinkProcessable(CurrentProcessable);
|
||||||
var result = await CurrentProcessable.ProcessSingleAsync(libraryBook, validate: true);
|
|
||||||
|
StatusHandler result;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = await CurrentProcessable.ProcessSingleAsync(libraryBook, validate: true);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error(ex, $"{nameof(Processable_Completed)} error");
|
||||||
|
|
||||||
|
result = new StatusHandler();
|
||||||
|
result.AddError($"{nameof(Processable_Completed)} error. See log for details. Error summary: {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
if (result.HasErrors)
|
if (result.HasErrors)
|
||||||
{
|
{
|
||||||
@ -303,11 +320,6 @@ namespace LibationAvalonia.ViewModels
|
|||||||
Completed?.Invoke(this, EventArgs.Empty);
|
Completed?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Completed?.Invoke(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ using System.Windows.Forms;
|
|||||||
using ApplicationServices;
|
using ApplicationServices;
|
||||||
using DataLayer;
|
using DataLayer;
|
||||||
using Dinah.Core;
|
using Dinah.Core;
|
||||||
|
using Dinah.Core.ErrorHandling;
|
||||||
using Dinah.Core.WindowsDesktop.Drawing;
|
using Dinah.Core.WindowsDesktop.Drawing;
|
||||||
using FileLiberator;
|
using FileLiberator;
|
||||||
using LibationFileManager;
|
using LibationFileManager;
|
||||||
@ -284,11 +285,27 @@ namespace LibationWinForms.ProcessQueue
|
|||||||
Logger.Info($"{((Processable)sender).Name} Step, Completed: {libraryBook.Book}");
|
Logger.Info($"{((Processable)sender).Name} Step, Completed: {libraryBook.Book}");
|
||||||
UnlinkProcessable((Processable)sender);
|
UnlinkProcessable((Processable)sender);
|
||||||
|
|
||||||
if (Processes.Count > 0)
|
if (Processes.Count == 0)
|
||||||
{
|
{
|
||||||
|
Completed?.Invoke(this, EventArgs.Empty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NextProcessable();
|
NextProcessable();
|
||||||
LinkProcessable(CurrentProcessable);
|
LinkProcessable(CurrentProcessable);
|
||||||
var result = await CurrentProcessable.ProcessSingleAsync(libraryBook, validate: true);
|
|
||||||
|
StatusHandler result;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = await CurrentProcessable.ProcessSingleAsync(libraryBook, validate: true);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error(ex, $"{nameof(Processable_Completed)} error");
|
||||||
|
|
||||||
|
result = new StatusHandler();
|
||||||
|
result.AddError($"{nameof(Processable_Completed)} error. See log for details. Error summary: {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
if (result.HasErrors)
|
if (result.HasErrors)
|
||||||
{
|
{
|
||||||
@ -298,11 +315,6 @@ namespace LibationWinForms.ProcessQueue
|
|||||||
Completed?.Invoke(this, EventArgs.Empty);
|
Completed?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Completed?.Invoke(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user