What I am trying to accomplish is catch an exception by the actual method that's being called. This is what I got so far, but what I found out is its only catching the exception by the namespace.
public static void ExceptionHandler(Exception ex)
{
if (ex.Source.Contains("Service"))
{
Console.WriteLine("***Warning: " + ex.Message + " Source: " + ex.Source);
}
if (ex.Source.Contains("SetServiceController"))
{
Console.WriteLine("***Error: " + ex.Message + " Source: " + ex.Source);
}
Console.WriteLine("Error: " + ex.Message + " Source: " + ex.Source);
}
Loading
VulpesPosted Jan 23, 2015, 8:55 AM
https://msdn.microsoft.com/en-us/library/system.exception.stacktrace%28v=vs.110%29.aspx
MarcPosted Jan 23, 2015, 9:19 AM