Octopus PowerShell step doesn't display error

I created a PowerShell script step wanting to execute “fake.ps1”. Obviously this is an erroneous script path and I want my build to notify me. The problem is “Deployment complete” has a green check mark next to it. Here’s what the build log statement

2014-04-15 21:30:09 INFO Begin script run
2014-04-15 21:30:09 DEBUG Running script against tentacle http://server:10933/
2014-04-15 21:30:12 INFO Job successful. Tentacle output follows:
2014-04-15 21:30:11 INFO ERROR: The term ‘fake.ps1’ is not recognized as the name of a cmdlet, function, script
2014-04-15 21:30:11 INFO ERROR: file, or operable program. Check the spelling of the name, or if a path was in
2014-04-15 21:30:11 INFO ERROR: cluded, verify that the path is correct and try again.
2014-04-15 21:30:11 INFO ERROR: At C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp\7cb46e7
2014-04-15 21:30:11 INFO ERROR: 5-d606-4eb6-8ec7-7a77355e900e.ps1:1 char:9
2014-04-15 21:30:11 INFO ERROR: + fake.ps1 <<<<
2014-04-15 21:30:11 INFO ERROR: + CategoryInfo : ObjectNotFound: (fake.ps1:String) [], ParentCont
2014-04-15 21:30:11 INFO ERROR: ainsErrorRecordException
2014-04-15 21:30:11 INFO ERROR: + FullyQualifiedErrorId : CommandNotFoundException
2014-04-15 21:30:11 INFO ERROR:
2014-04-15 21:30:11 INFO ==============================================
2014-04-15 21:30:11 INFO PowerShell exit code: 0
2014-04-15 21:30:11 INFO ==============================================

When a power shell step fails I want the build to break and notify me the deploy failed. How do I achieve this?
PS: I tried OctopusTreatWarningsAsErrors is true

-=Dan=-

Capture.PNG

Hi Dan - thanks for getting in touch. Propagating errors from PowerShell can be a bit tedious; here’s a line to add at the start of your script that might help:

$ErrorActionPreference = "Stop"

(Don’t forget to create a new release with the script changes.)

We’ve done a huge amount of work improving PowerShell handling in Octopus 2.0, if you can move forward this behaviour should be “on” by default.

Hope this helps,
Nick