# Error Handling

## How to handle plugin errors?

* [ ] Use the [**On Error Condition**](#getting-errors) to get the latest error
* [ ] Retrieve the latest error from the [**Get Last Error** expression](#getting-errors)

<figure><img src="/files/704yO2wElfXMGlDJh1L5" alt=""><figcaption></figcaption></figure>

## Getting errors&#x20;

The function is responsible for managing errors that occur during any plugin operation. When an error is detected, the function stores the error message in the internal variable. It then triggers the **On Error** condition, notifying the system that an error has occurred.

* **On Error Condition:** This condition is triggered whenever an error occurs in the plugin, allowing you to handle it within your Construct 3 project.
* **Get Last Error Expression:** The last error message can be retrieved using the **Get Last Error** expression, which returns the stored error message for debugging or user notifications.

This setup provides a consistent way to detect and respond to errors within your project.


---

# Agent Instructions: 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:

```
GET https://docs.metaproprotocol.com/developer-documentation/developer-documentation-for-the-construct-3-plugin/error-handling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
