Skip to content

Error Handling

Calls return { data, error, response } rather than throwing on API errors:

const { data, error, response } = await ch.getCompanyProfile({
path: { company_number: "00000000" },
});
if (error) {
console.error(response.status, error);
}

Pass throwOnError: true on a call to get a throwing variant with non-optional data:

const { data } = await ch.getCompanyProfile({
path: { company_number: "00445790" },
throwOnError: true,
});