Skip to content

Commit 65604cd

Browse files
github-actions[bot]l-trottapquentin
authored
Async search error handling (#5597) (#5656)
* async search error handling * using common class --------- (cherry picked from commit 025a87b) Co-authored-by: Laura Trotta <[email protected]> Co-authored-by: Quentin Pradet <[email protected]>
1 parent 6dc6c54 commit 65604cd

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

specification/async_search/_types/AsyncSearchResponseBase.ts

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

2020
import { Id } from '@_types/common'
21+
import { ErrorCause } from '@_types/Errors'
2122
import { DateTime, EpochTime, UnitMillis } from '@_types/Time'
2223
import { AsyncSearch } from './AsyncSearch'
2324

@@ -48,9 +49,23 @@ export class AsyncSearchResponseBase {
4849
*/
4950
completion_time?: DateTime
5051
completion_time_in_millis?: EpochTime<UnitMillis>
52+
error?: ErrorCause
5153
}
5254
export class AsyncSearchDocumentResponseBase<
5355
TDocument
5456
> extends AsyncSearchResponseBase {
5557
response: AsyncSearch<TDocument>
5658
}
59+
60+
export class AsyncSearchResponseException<TDocument> {
61+
is_partial: boolean
62+
is_running: boolean
63+
expiration_time?: DateTime
64+
expiration_time_in_millis: EpochTime<UnitMillis>
65+
start_time?: DateTime
66+
start_time_in_millis: EpochTime<UnitMillis>
67+
completion_time?: DateTime
68+
completion_time_in_millis?: EpochTime<UnitMillis>
69+
error?: ErrorCause
70+
response?: AsyncSearch<TDocument>
71+
}

specification/async_search/get/AsyncSearchGetResponse.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@
1717
* under the License.
1818
*/
1919

20-
import { AsyncSearchDocumentResponseBase } from '@async_search/_types/AsyncSearchResponseBase'
20+
import {
21+
AsyncSearchDocumentResponseBase,
22+
AsyncSearchResponseException
23+
} from '@async_search/_types/AsyncSearchResponseBase'
2124

2225
export class Response<TDocument> {
2326
body: AsyncSearchDocumentResponseBase<TDocument>
27+
exceptions: [
28+
{
29+
statusCodes: [404, 400, 500, 429]
30+
body: AsyncSearchResponseException<TDocument>
31+
}
32+
]
2433
}

specification/async_search/submit/AsyncSearchSubmitResponse.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@
1717
* under the License.
1818
*/
1919

20-
import { AsyncSearchDocumentResponseBase } from '@async_search/_types/AsyncSearchResponseBase'
20+
import {
21+
AsyncSearchDocumentResponseBase,
22+
AsyncSearchResponseException
23+
} from '@async_search/_types/AsyncSearchResponseBase'
2124

2225
export class Response<TDocument> {
2326
body: AsyncSearchDocumentResponseBase<TDocument>
27+
exceptions: [
28+
{
29+
statusCodes: [404, 400, 500, 429]
30+
body: AsyncSearchResponseException<TDocument>
31+
}
32+
]
2433
}

0 commit comments

Comments
 (0)