입력·출력·결과 처리›오류 처리

오류 처리

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_REQUIREDPublic Key was not supplied.
AUTH_NETWORK_ERRORAuthorization service could not be reached.
AUTH_DENIEDAuthorization was rejected.
SESSION_EXPIREDThe SDK session expired.
TOOL_NOT_ENABLEDThe Public Key does not enable that Tool.
MODE_NOT_ENABLEDThe Public Key does not enable that mode.
MODE_NOT_SUPPORTEDThe 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.