When interacting with the Firmhouse API, you might encounter errors such as validation errors, not found errors, server errors etc. You can handle these errors by catching them and handling them accordingly.
Not Found Error
import { NotFoundError } from '@firmhouse/firmhouse-sdk';
try {
const products = await client.products.fetch("invalid-product-id")
} catch (error) {
if (error instanceof NotFoundError) {
console.log("Product not found");
}
}