Skip to Content
Errors

Call errors

Learn what a call can fail with and how each error is typed.

Every call's type lists the ways it can fail, so TypeScript knows which errors you've handled and which are left. This page describes those errors. The other pages in this section show how to catch them and how to turn the API's error responses into errors of your own.

What can go wrong

A call can fail in three ways, each with its own tagged error. Plugins can add their own, such as timeout's TimeoutError, and statusErrors can turn an HttpError into one of your own.

The following table lists each error, when it happens and the fields it carries:

ErrorWhenFields
NetworkErrorNo response: offline, DNS failure, connection refused, CORS rejection.method, url, cause
HttpErrorA response outside 200–299 (3xx included).method, url, status, headers, text, body
DecodeErrorA 2xx body that isn't JSON or doesn't match output. Only on calls with output.method, url, status, issue, message
TimeoutError (plugin)The timeout plugin's limit passed before the response arrived.method, url, duration

Error pages

The rest of this section covers each part of handling errors:

On this page