Skip to content

v13.0.0

Choose a tag to compare

@maxholman maxholman released this 02 May 12:03
· 155 commits to master since this release

Breaking changes

  • Removed ServiceResponseError export. ServiceError now covers all response error paths.
  • ServiceError constructor signature changed from (message, response) to (message, code, response).

What's new

  • ServiceError.fromResponse(response, body) reconstructs a ServiceError from a raw fetch result, unpacking structured {code?, message, details?} bodies and falling back to response.statusText otherwise.
  • client.json() now sends Accept: application/json by default (overridable via runtime headers).
  • All thrown errors carry the originating Response on .response.

Migration

  • Replace catch (e) { if (e instanceof ServiceResponseError) ... } with a single instanceof ServiceError check.
  • If you constructed ServiceError directly: insert the status code as the second argument.