-ErrorAction Silentlycontinue

I am working on a project where we are using some beta powershell modules provided by the vendor. They keep changing and they do contain errors which have been masked with -erroraction silentlycontinue. Basically they are making rest call to look for a thing, if it errors, then create it. As far as I’m concerned the module does what it is meant to do.

Except, even though the error is set to silently continue, these errors have been captured by octopus. I can run the code fine in a powershell session on the host but when I run it inside octopus, Octopus thinks there is an error. I don’t want to have to recode the changing module everytime, trying to fix their module is their job and they have written their code expecting errors to tell them when something doesn’t exist.

My question
Can Octopus respect the -erroraction setting for a line of code? or perhap asked another way, how can I trap or ignore an error that has already been hidden by the parameter -erroraction silentlycontinue inside an octopus step?

Hi Matt,

Thanks for reaching out!

I just tested this really quick in Octopus 3.12.3 with the below line:

Get-Service Foo -ErrorAction Silentlycontinue

Octopus swallowed the error as expected and the step was marked as successfull. I’m wondering:

  • What code are you running that’s not behaving in a way that silentlyContinue swallows the error? Can you reproduce this with Get-Service Foo -ErrorAction SilentlyContinue?

  • Which version of Octopus are you running?