Skip to content

Errors ​

The SDK exports OpenCloudError and isOpenCloudError:

ts
class OpenCloudError extends Error {
  code: string;
  surface: "app" | "auth" | "data" | "files" | "functions" | "notifications" | "realtime" | "telemetry";
  status: number | null;
  requestId: string | null;
  retryable: boolean;
  details?: unknown;
}
js
import { opencloud, isOpenCloudError } from "/_opencloud/sdk.js";

try {
  await opencloud.data.table("items").create({ title });
} catch (error) {
  if (!isOpenCloudError(error)) throw error;

  if (error.code === "AUTH_REQUIRED") {
    renderSignIn();
  } else {
    renderSafeFailure({ requestId: error.requestId, retryable: error.retryable });
  }
}

Stable SDK codes include argument and response validation failures, auth and capability failures, network failures, manifest-aware Function failures, file size and attachment failures, and normalized platform codes. The exact backend code is preserved when it is a safe uppercase application code.

retryable is guidance, not permission to repeat a non-idempotent product action. High-level SDK operations already apply their documented idempotency or reconciliation behavior. Keep requestId for diagnostics. Do not parse raw response bodies or show details directly to an end user.

Grow the apps your life needs.