Class: ApiError
Defined in: src/errors.ts:18
Thrown when the server returns a non-OK response.
Example
ts
import { ApiError } from 'sorbus';
try {
await api.invoices.show({ id: '1' });
} catch (error) {
if (error instanceof ApiError) {
console.log(error.status);
console.log(error.body);
}
}Extends
Error
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
body | unknown | The parsed response body, or null if unparseable. | src/errors.ts:20 |
status | number | The HTTP status code. | src/errors.ts:22 |