mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Better global exception handling
Save error now shows a Save as button Recent list now not changed at every access (only on actual file open) Some code refactoring
This commit is contained in:
@@ -9,6 +9,7 @@ using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Exceptions;
|
||||
using ModernKeePass.Interfaces;
|
||||
|
||||
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
|
||||
@@ -37,14 +38,17 @@ namespace ModernKeePass
|
||||
|
||||
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
|
||||
{
|
||||
// TODO: catch only save errors for now, rethrow (do not handle) otherwise
|
||||
// Save the argument exception because it's cleared on first access
|
||||
var exception = unhandledExceptionEventArgs.Exception;
|
||||
MessageDialogHelper.ShowErrorDialog(
|
||||
var realException =
|
||||
exception is TargetInvocationException &&
|
||||
exception.InnerException != null
|
||||
? exception.InnerException
|
||||
: exception);
|
||||
: exception;
|
||||
|
||||
if (!(realException is SaveException)) return;
|
||||
unhandledExceptionEventArgs.Handled = true;
|
||||
MessageDialogHelper.SaveErrorDialog(realException as SaveException, Database);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user