Skip to content

Commit 7108b69

Browse files
Anaethelionswallez
authored andcommitted
Add exception to core.get to handle index_not_found & document not found (#2156)
* Add exception to core.get to handle index_not_found & document not found * add documentation to get exception
1 parent 0aa83fd commit 7108b69

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

output/schema/schema.json

Lines changed: 39 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_global/get/GetResponse.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@
1818
*/
1919

2020
import { GetResult } from '@global/get/types'
21+
import { ErrorResponseBase } from '@_types/Base'
2122

2223
export class Response<TDocument> {
2324
body: GetResult<TDocument>
25+
exceptions: [
26+
{
27+
// Special case exception for 404 status code, Elasticsearch will return either:
28+
// * index_not_found_exception as an error if the index doesn't exist
29+
// * GetResult with only the requested _id, _index properties and found as a false boolean
30+
statusCodes: [404]
31+
body: GetResult<TDocument> | ErrorResponseBase
32+
}
33+
]
2434
}

0 commit comments

Comments
 (0)