> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/troubleshooting-and-resources/knowledge-base-article/pipeline-to-succeed-on-failure.md).

# Pipeline success on failure

Pipeline is showing status as Success even after having errors

## Problem Statement <a href="#problem-statement" id="problem-statement"></a>

Pipeline having shell script step is succeeding even though the shell script throws error during the execution

## Resolution <a href="#resolution" id="resolution"></a>

For shell script step we identify the status of the step based on the exit code status of the script that we execute either on the delegate host or the remote host. If the script has a success exit status we will mark the step as success and for failure exit status the step fails.

Our script should be written in a way that if the script is throwing errors and we want to fail the script on error it should exit the script execxution with corresponding error exit code.

In bash we can add the below option:

`set -e`

For powershell to achieve the similar scenario we can add the below to our script:

`$ErrorActionPreference = "Stop"`
