Skip to content

Instantly share code, notes, and snippets.

@The-Quill
Created January 6, 2016 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save The-Quill/9b1397d5a8f351170818 to your computer and use it in GitHub Desktop.
Save The-Quill/9b1397d5a8f351170818 to your computer and use it in GitHub Desktop.
Error handler
using System;
namespace Foo
{
public class Utils
{
public static object InvokeAndCatchError(Delegate del, object parameters, params object[] optionalParameters)
{
try
{
return del.Method.Invoke(parameters, optionalParameters);
}
catch (Exception e)
{
Console.WriteLine("Exception occured:");
Console.WriteLine(e);
return null;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment