.net interop exceptions

BgestelBgestel Member Posts: 136
edited 2013-03-29 in NAV Three Tier
considder the following in a nav 2013 situation

if ListofFiles.find('-') then
repeat
Xmldoc.Load(ListofFiles.Path);
until ListofFiles.next = 0;

Where Xmldoc is System.Xml.XmlDocument.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

and let's assume this is an unattended process running on a nas service tier.

In the good old days, the xml document automation would return true or false to signal if something went wrong in the import. .net will throw an exception an Nav has no clue what just happened and rolles back the transaction.

To work arround this :
- i could wrap the if codeunit.run constraction arround the .net xml assembly
-> I dont like this approach because it produces spagetti code
- i cook my own custom xml assembly , doing the trying and catching and translating it to a true / false return
-> I dont like this approach because it will increase maintenance and introduce deployment dependencies
- Ms development could provide some serious exception handling syntax to nav to complete the .net interop.
-> sounds great.

Does annyone have other smart idea's to work arround this ??
**********************
** SI ** Bert Van Gestel **
**********************
Sign In or Register to comment.