Document http api error exposure #2507
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Thanks for taking the time to fill out this pull request!
Issue Reference
Please link to any related issues
This PR addresses a common user query regarding error handling for the BAML HTTP/REST API, as highlighted by a user asking "Hey, how to do error handling for REST api ?".
Changes
Please describe the changes proposed in this pull request
This PR introduces comprehensive documentation for error handling in the BAML HTTP API.
fern/01-guide/02-languages/rest-error-handling.mdx
which details:invalid_argument
,client_error
,client_http_error
,validation_failure
,finish_reason_error
, andinternal_error
.Server-Sent Events
) responses.fern/docs.yml
to restructure the "REST API (other languages)" section into a collapsible group, including "Getting Started" and the new "Error Handling" guide.fern/01-guide/02-languages/rest.mdx
to direct users to the new error handling guide.fern/03-reference/baml-cli/serve.mdx
with a link to the new guide.Testing
Please describe how you tested these changes
baml-runtime
unit tests were run and passed successfully.Screenshots
If applicable, add screenshots to help explain your changes
[Add screenshots here...]
PR Checklist
Please ensure you've completed these items
Additional Notes
Add any other context about the PR here
This PR aims to provide a clear and comprehensive guide for developers on how to anticipate, understand, and handle errors when interacting with the BAML HTTP API. It addresses a gap in the existing documentation and clarifies the error handling mechanisms implemented in
engine/baml-runtime/src/cli/serve/error.rs
.Slack Thread