Skip to content

Conversation

@BrettCleary
Copy link

The response object is being returned on API errors instead of a human readable error message.

This means the calling code has to call await error.text() in the surrounding catch block, which is an anti-pattern since other functions in the try block could throw a different type.

If you call

console.log(`Error: ${error}`)

you get something like Error: [Response object].

With this change, this log code in the catch block now gives something readable like the following without having to assume the error object is a response object at runtime
{"statusCode":400,"timestamp":"2025-11-06T02:17:35.478Z","path":"/v1/actions/enter","message":"Value must be at least 0.1"}

Copilot AI review requested due to automatic review settings November 6, 2025 03:29
@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2025

⚠️ No Changeset found

Latest commit: a16d75a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the SDK version to 0.0.5 and improves error handling in the API client by extracting response text from failed HTTP requests before rejecting the promise.

  • Modified error handling to read and return response text instead of the raw response object
  • Bumped package version from 0.0.4 to 0.0.5

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/api-client.ts Enhanced error handling to extract and return response text for failed requests
package.json Incremented version number to 0.0.5

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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