> 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/huong-dan-cac-action/workflow/throw.md).

# Throw

Throw là hành động dùng để chủ động bắn ra một thông báo lỗi (Exception) do bạn tự định nghĩa và dừng ngay lập tức luồng kịch bản hiện tại.

Sự khác biệt cốt lõi giữa Throw và Stop nằm ở trạng thái báo cáo sau khi dừng luồng:

* Stop: Tắt luồng và hệ thống vẫn ghi nhận trạng thái chạy hoàn thành (Completed - hiển thị màu xanh).
* Throw: Tắt luồng và hệ thống sẽ đánh dấu trạng thái gặp lỗi (Error - bôi đỏ) kèm theo nội dung lỗi cụ thể lên nhật ký hệ thống (Log).

#### Ví dụ thực tế: Ném lỗi khi hết số dư tài khoản quảng cáo

Giả sử bạn làm kịch bản tự động lên chiến dịch quảng cáo. Trước khi thiết lập, kịch bản cần vào trang quản lý để kiểm tra ngân sách. Nếu số dư bằng 0, kịch bản không thể chạy tiếp:

* Cách cấu hình:
  * Dùng khối lệnh If kiểm tra: `Nếu số dư = 0`.
  * Nằm bên trong khối If, bạn gọi hành động Throw và điền nội dung thông báo lỗi là: `"Lỗi: Tài khoản hết tiền, không thể lên camp!"`.
* Kết quả: Khi chạy đến đây, luồng của profile này sẽ lập tức đóng lại. Trên bảng quản lý tiến độ của GPM Automate, dòng profile đó sẽ được chuyển sang trạng thái Error (Bôi đỏ) kèm dòng chữ thông báo lỗi. Bạn chỉ cần nhìn lướt qua danh sách là lọc ra ngay những tài khoản nào đang bị lỗi để xử lý mà không bị lẫn lộn với những luồng chạy thành công (Completed).

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

<figure><img src="/files/sKJHhlphR5EFdXVd10lN" 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/huong-dan-cac-action/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.
