Added automatic error handling to show a message box

This commit is contained in:
Thorsten Sommer 2022-07-17 12:32:43 +02:00
parent 32ebd69194
commit 925f777d36
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -0,0 +1,15 @@
using Processor;
namespace UI_WinForms;
public static class ExtensionsError
{
public static ProcessorResult<TResult> ProcessError<TResult>(this ProcessorResult<TResult> result)
{
if (result.Successful)
return result;
MessageBox.Show(result.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return result;
}
}