I am trying to catch specific SoapExceptions but cannot find a error code to use.
I have tried getting the error code using;
catch(SoapException e)
{
// Get error code
int ErrorCode = System.Runtime.InteropServices.Marshal.GetExceptionCode(); //System.Runtime.InteropServices.Marshal.GetHRForException(e);
switch (ErrorCode)
{
case -2146233087:
{
// Default parameters have not been established in the report
return "false";
}
default:
{
return "false";
}
}
}
But this does not work. Does anyone know where to look for the error code? The only soloution I can possible think of is doing a string match on
e.GetBaseException().ToString()
but that would be ugly
ANSWER
string ErrorCode = ((e.Detail).FirstChild).InnerText;
string ErrorCode = ((e.Detail).FirstChild).InnerText;
returned "rsAccessDenied" which is what I needed to evaluate my error.