Added automatic error handling to show a message box

This commit is contained in:
tsommer committed 2022-07-17 12:32:43 +02:00
1 parent 32ebd69194
commit 925f777d36
1 file changed
+15
@@ -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;
}
}