So it looks like Ant uses BuildException
to wrap any exceptions that are thrown.
To show a message, you'd need to implement something like:
def ant = new AntBuilder()
try {
ant.scp(
trust:true,
file:"theFileToLook",
todir:"destinationFolder",
keyfile: "myrivateKeyFile",
verbose:true
)
}
catch( BuildException ex ) {
if( ex.exception instanceof IOException ) {
println "Whoops! $ex.exception.message"
}
else {
throw ex
}
}