Passing PowerShell Error back to Octopus

We have a couple custom step templates and I was wondering if its possible and if so how to pass exceptions from PowerShell back into Octopus Deploy. Currently we are catching and displaying the error like this:

catch {
$message = "error generating the script"
Write-Host $_.Exception.ToString()
exit 10004
}

This works great for displaying the error in the detailed error log however we want to send this message to the development team when it fails. Should our script set this variable (Octopus.Deployment.ErrorDetail) to the exception that is thrown?

Thanks for the help!

Hi Matt,

Thanks for reaching out. Looks like a bug. I’ve created a github issue for it, feel free to follow its progress on this link

Thanks,

Dalmiro

Thanks for looking into this for us Dalmiro!