Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Geosearch - Enhance lat/lng format error messages (#149)
Browse files Browse the repository at this point in the history
* Update the geosearch error message

* misc: organiser error message in the right specification

Co-authored-by: Guillaume Mourier <[email protected]>
  • Loading branch information
irevoire and gmourier committed Jul 7, 2022
1 parent 5a7e688 commit 80d5910
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 26 deletions.
22 changes: 0 additions & 22 deletions text/0059-geo-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,28 +119,6 @@ csv format example

- 🔴 Giving a bad formed `_geo` that do not conform to the format causes the `update` payload to fail. A new `invalid_geo_field` error is given in the `update` object.

##### Errors Definition

## invalid_geo_field

### Context

This error occurs when the `_geo` field of a document payload is not valid.

### Error Definition

```json
{
"message": "The document with the id: `:documentId` contains an invalid _geo field: :syntaxErrorHelper.",
"code": "invalid_geo_field",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_geo_field"
}
```

- The `:documentId` is inferred when the message is generated.
- The `:syntaxErrorHelper` is inferred when the message is generated.

---

### **As an end-user, I want to filter documents within a geo radius.**
Expand Down
21 changes: 17 additions & 4 deletions text/0061-error-format-and-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -727,22 +727,35 @@ HTTP Code: `400 Bad Request`

### Context

This error occurs when the `_geo` field of a document payload is not valid.
These errors occurs when the `_geo` field of a document payload is not valid. Either the latitude / longitude is missing or is not a number.

### Error Definition

#### Variant: Missing `_geo.lat` or `_geo.lng` field.

```json
{
"message": "The document with the id: `:documentId` contains an invalid _geo field: `:syntaxErrorHelper`.",
"message": "Could not find :coord in the document with the id: `:documentId`. Was expecting a `:field` field.",
"code": "invalid_geo_field",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_geo_field"
}
```

#### Variant: Coordinate can't be parsed.

```json
{
"message": "Could not parse :coord in the document with the id: `:documentId`. Was expecting a number but instead got `:value`.",
"code": "invalid_geo_field",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_geo_field"
}
```

- The `:documentId` is inferred when the error message is generated.
- The `:syntaxErrorHelper` is inferred when the error message is generated.
- The `:documentId` is inferred when the message is generated.
- The `:coord` is either `latitude` or `longitude` depending on what's wrong.
- The `:field` is either `_geo.lat` or `_geo.lng` depending on what's wrong.

---

Expand Down

0 comments on commit 80d5910

Please sign in to comment.