Error logging in Octopus

Issue

When you have scripted steps in Octopus, you can usually use Write-Error to sent out an error message and stop the deployment. But it looks a bit ugly and you still have to dive in to the logs to find the real error message.
It is best to use the built n Octopus function Fail-Step <string>
If you use this in your script, if it is triggered it makes your logs look much more readable.

Usage

in your script have something like:
1
if ($errorOccured)
2
{
3
Fail-Step "There was error with the processing and the details are.... "
4
}
5
else
6
{
7
Write-Host "All validation passed. Continuing the deployment.
8
}
Copied!

Reference

Copy link