> For the complete documentation index, see [llms.txt](https://razortheory.gitbook.io/third-party-monitoring-module-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://razortheory.gitbook.io/third-party-monitoring-module-documentation/technical-documentation/api-documentation/error-handling.md).

# Error Handling

Original Django Rest Framework has been modified a bit for consistency and extended in order to include error codes.

Expected http status codes are **404** and **400**. **400** response details are presented below:&#x20;

#### General / Non Field Errors

A response for a single error looks like the following:

```javascript
{
    "non_field_errors": [
        "Error message"
    ],
    "error_codes": [
        "invalid"
    ]
}
```

Multiple errors can be provided under `non_field_errors` key, eg.:

```javascript
{
    "non_field_errors": [
        "Error message",
        "Another error"
    ],
    "error_codes": [
        "invalid",
        "invalid"
    ]
}
```

#### Field Errors

Errors, associated with the fields, will be returned as a mapping:

```javascript
{
    "email": [
        "This field is required."
    ],
    "error_codes": {
        "email": [
            "required"
        ]
    }
}
```

And of course can contain multiple messages for a single field:

```javascript
{
    "field1": [
        "Err1",
        "Err2"
    ],
    "field2": [
        "Err3"
    ],
    "error_codes": {
        "field1": [
            "invalid",
            "invalid"
        ],
        "field2": [
            "invalid"
        ]
    }
}
```

Any exceptions to these rules should be treated as bugs and reported.


---

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

```
GET https://razortheory.gitbook.io/third-party-monitoring-module-documentation/technical-documentation/api-documentation/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.
