The exceptions from Groovy are good, but we should wrap them so they are topped with a "your script has something wrong in it" message to focus remedial attention.
Comments from the original github issue:
andrewharmellaw commented 9 months ago
I need to figure out how to write to the Jenkins job output console directly. Then we can control what is written here.
andrewharmellaw commented 9 months ago
http://javadoc.jenkins-ci.org/hudson/model/TaskListener.html is the thing to use. It only has "error" and "fatalError" methods, but it does seem to do what we need (i.e. write useful messages to a user to the Jenkins Console output). I'll code this in and take a look.
andrewharmellaw commented 9 months ago
listener.getLogger().print(...) is my friend...
quidryan commented 8 months ago
@claymccoy pointed out that we should show the script when printing an error message. I think we could also look at the stack to see what line number the error was in, and we can show line number when printing it out.
andrewharmellaw commented 8 months ago
Totally agree. I have half worked on this (but not the line number bit) but not checked it in. I'll take a look at how far you're got in my absence and see what the priority is - finish this or something else.
|