R – How to do error handling in nant build scripts

buildnantscripting

I am writing a NAnt build script which is responsible for deploying some files to an iss server. As part of this I would like to add error handling to my scripts – something which I haven't used before.

Introducing error handling inevitably leads to thoughts about the structure of the build file (s). I think of structure as the grouping of logic in targets and the dependencies between these.

In NAntContrib I have found the task which should make the job easier than the standard "onfailure" property. Unfortunately its only possible (at least for me) to find short and fairly simple examples of its usage. What I need is recommendations on how to make an entire file structure that handles errors for the more complex scenarios.

Best Answer

How about using the try/catch blocks instead around any fragile code?

http://nantcontrib.sourceforge.net/release/0.85/help/tasks/trycatch.html