Error Handling
onError
Section titled “onError”| Type | (error: UpdogError) => void |
Called when the SDK catches an internal error. The SDK recovers where it can, and onError carries the error out to your logging and monitoring (Sentry, Datadog, and the like).
Error shape
Section titled “Error shape”type UpdogError = { code: UpdogErrorCode; message: string; source: string; originalError?: unknown;};Error codes
Section titled “Error codes”| Code | When |
|---|---|
PARSE_ERROR |
File parsing failed (corrupt CSV, invalid XLSX, etc.) |
RENDER_ERROR |
Component render failed (caught by error boundary) |
TRANSFORM_ERROR |
Data transformation failed (column transform, value mapping) |
VALIDATION_ERROR |
Validation execution failed (validator threw instead of returning) |
WORKER_ERROR |
Web Worker failed (filter worker, chat transform worker) |
COMMAND_ERROR |
Undo/redo command failed |
OPERATION_ERROR |
General operation failed (bulk mutations, imports, clipboard access) |
HOOK_ERROR |
A hook you passed failed (threw, timed out, or broke its return contract) and the SDK carried on with built-in behavior |
license.quota_exceeded |
The account used up the Free plan’s monthly row limit |
Example
Section titled “Example”onError={(error) => { Sentry.captureException(error.originalError ?? error, { tags: { code: error.code, source: error.source }, });}}Clipboard access
Section titled “Clipboard access”The browser can refuse a page access to the system clipboard. Both directions
report OPERATION_ERROR through onError.
Copy and cut write to the clipboard. When the browser refuses that write, the SDK shows the person a toast, and the copied values stay available for pasting inside the grid.
Paste reads from the clipboard. When the browser refuses that read, the paste stops. Values copied inside the grid still paste.
Async validation failures
Section titled “Async validation failures”Remote checks (unique.fn and { type: "asyncFunction" } validators) have failure modes a sync validator does not. When a check throws, returns malformed data, or goes 60 seconds without any activity, the cells still awaiting a verdict become unverified. The SDK leaves them unmarked in the grid, so your backend should re-validate those values at save time.
- The SDK reports a check failure (rejection or malformed result) through
onErroras aVALIDATION_ERROR. One sweep produces one report, whatever the number of cells behind it. A timeout is silent. - Verdicts streamed through
onChunkbefore a failure stay applied, so a crash at 99% keeps the 99%. - Do retries inside your
fn. Once it rejects, the SDK marks the remaining cells unverified and does not re-ask.
CSV parse warnings
Section titled “CSV parse warnings”A malformed row in a CSV, an unclosed quote for example, still imports. The file parses, the rows enter the grid, and the user sees a toast reporting how many rows had formatting issues along with the first few affected row numbers. These warnings stay in the UI and never reach onError. A hard parse failure still raises a PARSE_ERROR.
Free plan row limit
Section titled “Free plan row limit”An account on the Free plan can submit 100,000 rows a calendar month. Once the account reaches the limit, the editor shows an “Unavailable” screen on production domains until the next month starts. Localhost and preview domains keep working.
onError receives the limit and the reset date.
{ code: "license.quota_exceeded", message: "Free plan limit reached: 100,000 rows this month. The importer is paused until November 1.", source: "license",}Domain not on the key
Section titled “Domain not on the key”Every API key carries the list of domains it works on. A domain covers its subdomains, so a key that lists app.com also works on eu.app.com. On any other production domain, the license check answers license.domain_not_allowed, and the editor shows a “Domain not allowed” screen. This code stays inside the editor and never reaches onError.
Add the domain to the key in the console. Localhost and preview domains work without a listed domain.
