Fix writing Jenkins output
Add more useful error message.