Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exception to core.get to handle index_not_found & document not found #2156

Merged
merged 2 commits into from
Jun 27, 2023

Conversation

Anaethelion
Copy link
Contributor

This adds an exception to the core.get response to handle index_not_found_exception and document not found.

exceptions: [
{
statusCodes: [404]
body: GetResult<TDocument> | ErrorResponseBase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining that ErrorResponseBase will be returned if the index doesn't exist, and GetResult if the id doesn't exist, and in that case it will only contain "found": false, _id and _index?

And for the sake of nitpicking flip the two members of the union: start with the result for the unknown index and finish with the result for the unknown id 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation added!

The order is consistent with the existing exceptions in the rest of the specification; I suggest we keep it that way.

@github-actions
Copy link
Contributor

Following you can find the validation results for the API you have changed.

API Status Request Response
get 🟢 94/94 91/91

You can validate this API yourself by using the make validate target.

@Anaethelion Anaethelion requested a review from swallez June 27, 2023 15:12
Copy link
Member

@swallez swallez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Anaethelion Anaethelion merged commit 86b3c63 into main Jun 27, 2023
@Anaethelion Anaethelion deleted the add_missing_exception_get branch June 27, 2023 15:22
github-actions bot pushed a commit that referenced this pull request Jun 27, 2023
…und (#2156)

* Add exception to core.get to handle index_not_found & document not found

* add documentation to get exception
github-actions bot pushed a commit that referenced this pull request Jun 27, 2023
…und (#2156)

* Add exception to core.get to handle index_not_found & document not found

* add documentation to get exception
github-actions bot pushed a commit that referenced this pull request Jun 27, 2023
…und (#2156)

* Add exception to core.get to handle index_not_found & document not found

* add documentation to get exception
Anaethelion added a commit that referenced this pull request Jun 27, 2023
…und (#2156) (#2157)

* Add exception to core.get to handle index_not_found & document not found

* add documentation to get exception

Co-authored-by: Laurent Saint-Félix <[email protected]>
Anaethelion added a commit that referenced this pull request Jun 27, 2023
…und (#2156) (#2158)

* Add exception to core.get to handle index_not_found & document not found

* add documentation to get exception

Co-authored-by: Laurent Saint-Félix <[email protected]>
Anaethelion added a commit that referenced this pull request Jun 27, 2023
…und (#2156) (#2159)

* Add exception to core.get to handle index_not_found & document not found

* add documentation to get exception

Co-authored-by: Laurent Saint-Félix <[email protected]>
@Anaethelion
Copy link
Contributor Author

Found in elastic/go-elasticsearch#678

swallez pushed a commit that referenced this pull request Jul 5, 2023
…und (#2156)

* Add exception to core.get to handle index_not_found & document not found

* add documentation to get exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants