Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions src/content/docs/errors/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,44 @@ RFC 9457 is a standardized format for expressing error details in HTTP API respo
- **`title`**: A short, human-readable summary of the problem type.
- **`status`**: The HTTP status code.
- **`detail`**: A human-readable explanation specific to this occurrence of the problem.
{/* - **`instance`**: An indication on which instance of the server the error occured NOT USED currently */}
- **`instance`**: An indication on which instance of the server the error occured NOT USED currently

## Example

### partial response error (2xx)

When the `errors` field appear inside a 200 response, it will contain a list of errors in the page with a pointer to the field that cannot be correctly rendered but without the `status` field

### Example

```json
{
"id": "swsh3-136",
"name": "Furret",
...
"errors": [
{
"type": "https://tcgdex.dev/errors/provider-error",
"title": "TCGdex encountered an error while communicating with a provider",
"provider": "tcgcsv",
"details": "Your application has flagged for overuse and has been blocked. [...]",
"pointer": "#/pricing/tcgplayer",
"instance": "eu2"
}
]
}
```

### Full Error response (4xx/5xx)
An example JSON response using RFC 9457 look like this:
```json
{
"type": "https://tcgdex.dev/errors/not-found",
"title": "The resource you are trying to reach does not exists",
"status": 404,
"endpoint": "/v2/i-do-not-exists",
"method": "GET"
"method": "GET",
"instance": "eu2"
}
```

Expand Down
45 changes: 45 additions & 0 deletions src/content/docs/errors/provider-error.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: Provider error
description: A provider of the API encountered an error
---

This error is used when a provider the server is using encountered an error or when the server encounter an error while communicating with a provider.

## Status Code

## 2xx

When the `errors` field appear inside a 200 response, it will contain a list of errors in the page with a pointer to the field that cannot be correctly rendered but without the `status` field

### Example

```json
{
"id": "swsh3-136",
"name": "Furret",
...
"errors": [
{
"type": "https://tcgdex.dev/errors/provider-error",
"title": "TCGdex encountered an error while communicating with a provider",
"provider": "tcgcsv",
"details": "Your application has flagged for overuse and has been blocked. [...]",
"pointer": "#/pricing/tcgplayer"
}
]
}
```

## 5xx

### Example

```json
{
"type": "https://tcgdex.dev/errors/provider-error",
"title": "TCGdex encountered an error while communicating with a provider",
"status": 500,
"provider": "tcgcsv",
"details": "Your application has flagged for overuse and has been blocked. [...]"
}
```
Loading