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

ApiError for better response error details #32

Merged
merged 2 commits into from
May 6, 2024
Merged

ApiError for better response error details #32

merged 2 commits into from
May 6, 2024

Conversation

yen-tt
Copy link
Collaborator

@yen-tt yen-tt commented May 6, 2024

Create a custom Error, ApiError, which stores additional information: statusCode for the request, as well as apiCode and type from meta.errors field originates from Chat API response.

This allow higher-level Chat libraries to check for statusCode and implement retry logic for responses with 5XX status code.

Will deploy new minor version (v0.8.0)

J=CLIP-1189
TEST=manual&auto

see that unit tests passed
build chat-core and link the library locally to chat-headless and chat-ui-react. Force an internal error using yen-bot-2 (v18)'s CHIT_CHAT goal. See that the thrown error is instance of ApiError and contains the expected new fields.

@yen-tt yen-tt requested a review from a team as a code owner May 6, 2024 17:01
@yen-tt yen-tt merged commit 22abb07 into main May 6, 2024
8 checks passed
@yen-tt yen-tt deleted the dev/api-error branch May 6, 2024 18:13
yen-tt added a commit to yext/chat-headless that referenced this pull request May 6, 2024
bump chat-core version to v0.8.0 to get changes from yext/chat-core#32

J=CLIP-1189
TEST=manual&auto

see that unit tests passed
build chat-headless and link the library locally to chat-ui-react. Force an internal error using yen-bot-2 (v18)'s CHIT_CHAT goal. See that the thrown error is instance of ApiError and contains the expected new fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants