Issue
- Pipeline
load
throwsIOException
instead ofFileNotFoundException
if file not found when run in slave.
Environment
- CloudBees Jenkins Enterprise
- Pipeline
Resolution
If using a try / catch block to determine the root cause of the exception, you need to unwrap the IOException
to uncover the root cause.
Example:
node {
try {
load "filethatdoesnotexist.ext"
} catch(FileNotFoundException e) {
// do something
} catch(IOException e) {
if(e.getCause() != null && e.getCause() instanceof FileNotFoundException) {
// Inner exception is FileNotFoundException
// do something
} else {
// do something else
}
}
}
Comments
0 comments
Please sign in to leave a comment.