Gestion des erreurs
Handle SDK errors by code instead of parsing human-readable messages.
try / catch
try {
const result = await client.run("image-enhancer", {
file
});
} catch (error) {
if (error?.name === "ZaviloError") {
console.error(error.code, error.message);
} else {
console.error(error);
}
}Common authorization and mode errors
| PUBLIC_KEY_REQUIRED | Public Key was not supplied. |
|---|---|
| AUTH_NETWORK_ERROR | Authorization service could not be reached. |
| AUTH_DENIED | Authorization was rejected. |
| SESSION_EXPIRED | The SDK session expired. |
| TOOL_NOT_ENABLED | The Public Key does not enable that Tool. |
| MODE_NOT_ENABLED | The Public Key does not enable that mode. |
| MODE_NOT_SUPPORTED | The Tool itself does not support that mode. |
Tool-specific validation errors depend on the Tool's options and input contract. Use the Tool Reference as the source of truth for required options, ranges, enum values and file limits.