Truncate too-long error message

This commit is contained in:
Robert McRackan 2020-12-22 11:38:03 -05:00
parent d25c32ff45
commit 0e9f2c7681
2 changed files with 9 additions and 2 deletions

View File

@ -13,7 +13,7 @@
<!-- <PublishSingleFile>true</PublishSingleFile> --> <!-- <PublishSingleFile>true</PublishSingleFile> -->
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Version>4.1.5.1</Version> <Version>4.1.6.1</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using DataLayer; using DataLayer;
using Dinah.Core;
using Dinah.Core.ErrorHandling; using Dinah.Core.ErrorHandling;
using FileLiberator; using FileLiberator;
@ -346,6 +347,12 @@ namespace LibationWinForms.BookLiberation
try try
{ {
const int TRUNC = 150;
var errMsg = ex.Message.Truncate(TRUNC);
if (ex.Message.Length > TRUNC)
errMsg += "...";
var text = @$" var text = @$"
The below error occurred while trying to process this book. Skip this book permanently? The below error occurred while trying to process this book. Skip this book permanently?
@ -354,7 +361,7 @@ The below error occurred while trying to process this book. Skip this book perma
- Click NO to skip the book this time only. We'll try again later. - Click NO to skip the book this time only. We'll try again later.
Error: Error:
{ex.Message} {errMsg}
".Trim(); ".Trim();
var dialogResult = System.Windows.Forms.MessageBox.Show( var dialogResult = System.Windows.Forms.MessageBox.Show(
text, text,