# Error Handling

All exceptions fired from Neuron AI  are an extension of `NeuronException` . There are several types of exceptions that can help you understand what's going wrong, but because they inherit from the same root exception, they give you the ability to accurately detect agent errors in the context of your code:

```php
try {

    // Your code here...

} catch (NeuronAI\Exceptions\NeuronException $e) {
    // ...
} catch (NeuronAI\Exceptions\ProviderException $e) {
    // ...
} catch (NeuronAI\Exceptions\AgentException $e) {
    // ...
} catch (NeuronAI\Exceptions\ChatHistoryException $e) {
    // ...
} catch (NeuronAI\Exceptions\HttpException $e) {
    // ...
} catch (NeuronAI\Exceptions\ToolException $e) {
    // ...
} catch (NeuronAI\Exceptions\VectorStoreException $e) {
    // ...
} catch (NeuronAI\Exceptions\WorkflowException $e) {
    // ...
} catch (NeuronAI\Exceptions\DataReaderException $e) {
    // ...
}
```

### Monitoring & Debugging

If you want to be alerted on any error, consider to connect [**Inspector**](https://inspector.dev/) to your application.

After you sign up at the link above, make sure to set the `INSPECTOR_INGESTION_KEY` variable in the application environment file.

{% code title=".env" %}

```
INSPECTOR_INGESTION_KEY=nwse877auxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

{% endcode %}

The Agent will automatically instrument itself. Learn more on the [documentation](https://docs.neuron-ai.dev/agent/observability) for other configuration options.

<figure><img src="https://3903156011-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGHx4l2LknIex7vFIUg1R%2Fuploads%2FHvQndveNiX2R0D8q7Fzg%2Finspector.png?alt=media&#x26;token=14c7db94-20b8-40a3-9617-c906560bba29" alt=""><figcaption></figcaption></figure>
