I’m using a third party wsdl and sometimes a specifc method doesn’t work (value not sent), and i can’t get any error. The basic of code:
try
{
ret = ANASrv.InsertMeasurement(lguser, lgpass, estacoes.ToArray());
//evaluate error
if (ret.qtdInserted== 1)
{
WriteLog("Measurement Inserted Sucessfully");
}
else
{
WriteLog("Insert Failed");
WriteLog("Code error: " + ret.message[0]);
}
}
catch (Exception ex)
{
WriteLog("Any other error");
}
The question is, sometimes, the InsertMeasurement doesn’t work and the catch Execption not executed.
What can I do to capture any error in these situations?
An exception can only be caught once unless a THROW is used where it is captured. If InsertMeasurement contains an exception handler (or a library) you will not be able to capture the exception in your code.