# Error Handling

All exceptions fired from Neuron AI are an extension of `NeuronException` . There several type of exception that can help you understand unexpected errors, but since they inherit from the same root exception gives you the ability to precisely catch agent errors in the context of your code:

```php
try {

    // Your code here...

} catch (NeuronAI\Exceptions\NeuronException $e) {
    // catch all the exception generated just from the agent
} catch (NeuronAI\Exceptions\ProviderException $e) {
    // Fired from AI providers and embedding providers
}
```

If you want to be alerted on any error, consider to connect Inspector to your Agent instance. Learn more at the [**Observability**](/v1/advanced/observability.md) section.


---

# 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.neuron-ai.dev/v1/advanced/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.
