XmlDocument.root().SelectSingleNode() - or error handling in general

MortenSteengaard
MortenSteengaard Member Posts: 144
Hi experts,

I have a class that call various classes in AX 2009. It handles all the files in an folder.

I would like to catch all errors that may come from these classes, but some errors are not caught by try-catch {}

For instance, if an xml file is incorrect when I read it, the call to XmlDocument.root().SelectSingleNode(...) is giving an error message that translated to English must be something like: "Error when running code: The object is not initialized".

I could make an if sentence to find and handle that error, but is there a way to catch all the various errors, that my classes can make?

It seems that the error stops the program from running. Is there a way to handle the various exceptions and then go on with the next file in the folder?

Is the text from XmlDocuement an exception?

Hope you can help.