I have foreign class, which throw Exception "Unknown exception". I want to catch it in my code and write message like "Error! Do this steps:...".
So, my code:
try
{
var p = new MyObject(prms); // this code failed and throw exception-"Unknown exception"
return p;
}
catch (Exception ex)
{
// Output ex
Console.WriteLine("Error! "+ex.Message);
}
How to wrap foreign exception and show my text? Thanks!
P.S. foreign code looks like that:
try
{
lock (_lockObject)
{
return MyObject();
}
}
catch (Exception exp)
{
throw ThrowWrapper(exp);
}