Error logging in Octopus


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.


in your script have something like:
if ($errorOccured)
Fail-Step "There was error with the processing and the details are.... "
Write-Host "All validation passed. Continuing the deployment.