Skip to content

Conversation

@mattt
Copy link
Contributor

@mattt mattt commented Jul 24, 2023

For example, if a user tries to call replicate.trainings.create on a method that doesn't support trainings, they'll see the error message API request failed:: Bad request. Information for why the operation failed ("{version_id} is not a trainable model version!"} isn't provided to the consumer.

This PR introduces a new ApiError class that encapsulates API error responses. By throwing this instead of a bare string, consumers can get the failing request and response. This object also improves the default message to include the text of the response.

@mattt mattt requested a review from zeke July 24, 2023 13:08
Copy link
Member

@zeke zeke left a comment

Choose a reason for hiding this comment

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

🙏🏼 💛

@mattt mattt merged commit 6343c52 into main Jul 25, 2023
@mattt mattt deleted the mattt/error-details branch July 25, 2023 11:45
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.

3 participants