> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-en/action-guide/workflow/throw.md).

# Throw

Throw is an action used to actively throw an error message (Exception) that you define and immediately stop the current script flow.

The core difference between Throw and Stop lies in the reporting status after stopping the flow:

* Stop: Stops the flow and the system still records the running status as completed (Completed - displayed in green).
* Throw: Stops the flow and the system will mark the status as encountered an error (Error - highlighted in red) along with the specific error message in the system log (Log).

#### Practical example: Throwing an error when the advertising account balance is depleted

Suppose you are automating a script to launch an advertising campaign. Before setting it up, the script needs to go to the management page to check the budget. If the balance is 0, the script cannot continue:

* Configuration method:
  * Use an If block to check: `If balance = 0`.
  * Inside the If block, you call the Throw action and fill in the error message as: `"Error: Account out of funds, cannot launch camp!"`.
* Result: When it reaches this point, the flow of this profile will immediately close. On the progress management board of GPM Automate, that profile line will be switched to Error status (Highlighted in red) along with the error message. You can easily glance through the list to filter out which accounts are encountering errors for processing without mixing them up with successful flows (Completed).

<figure><img src="/files/0O0No3Ukfe9uDu9uaxa6" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/iCjjkuqpIe44TAYTQjZ6" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-en/action-guide/workflow/throw.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
