Ir al contenido

ErrorPage

Cuando algo falló de nuestro lado: qué pasó, que no se perdió nada, qué hacer ahora y la referencia que pedirá soporte. Fuera de la consola es una página; dentro, solo lo que falló lo dice.

import { EmptyState, Hash } from '@sypnia/ui/react'

En esta página
  1. En un computador
  2. En un celular
  3. Dentro de la consola
  4. Cuándo usarlo
  5. Para todos
  6. Props

En un computador

Una página propia, fuera de la consola. Pulsa «Intentar de nuevo», o abre los detalles técnicos.

Código
import { useState } from 'react';
import { AuthLayout, Button, CodeBlock, Disclosure, EmptyState, Hash, Page, PageHeader, Panel, Stack, Text, useSypnia } from '@sypnia/ui/react';

// When something failed on our side. Outside the console it is a page of its own; inside, only the part that failed
// says so and the rest of the screen keeps working. Both say what happened, that nothing was lost, and what to do now,
// and both carry the reference that support needs.
const en = {
  title: 'Something failed on our side', body: 'Nothing you did caused it, and nothing was lost. Try again in a moment; if it keeps happening, send us the reference below.',
  retry: 'Try again', retrying: 'Trying again…', status: 'See the status of Sypnia', ref: 'Reference', refLabel: 'error reference',
  home: 'Go to my projects', details: 'Technical details',
  page: 'Tables', pageLead: 'Everything this project keeps, as tables.', panel: 'Rows written today',
  partTitle: 'These numbers could not be loaded', partBody: 'The rest of the page works. Try again, or come back in a minute.',
  terms: 'Terms', help: 'Help',
};
const es: typeof en = {
  title: 'Algo falló de nuestro lado', body: 'No fue nada que hicieras, y no se perdió nada. Intenta de nuevo en un momento; si sigue pasando, envíanos la referencia de abajo.',
  retry: 'Intentar de nuevo', retrying: 'Intentando de nuevo…', status: 'Ver el estado de Sypnia', ref: 'Referencia', refLabel: 'referencia del error',
  home: 'Ir a mis proyectos', details: 'Detalles técnicos',
  page: 'Tablas', pageLead: 'Todo lo que guarda este proyecto, en tablas.', panel: 'Filas escritas hoy',
  partTitle: 'No se pudieron cargar estas cifras', partBody: 'El resto de la página funciona. Intenta de nuevo, o vuelve en un minuto.',
  terms: 'Términos', help: 'Ayuda',
};
const reference = 'err_7Hq2kVd9xR4mWp1c';
const trace = `GET /v1/projects/northwind/tables  503\nupstream: data-api (eu-west)\nat 2026-11-17 14:02:11 UTC`;

export default function ErrorPage({ variant = 'page' }: { variant?: 'page' | 'part' }) {
  const { locale } = useSypnia();
  const c = locale.startsWith('es') ? es : en;
  const [busy, setBusy] = useState(false);
  const retry = () => { setBusy(true); setTimeout(() => setBusy(false), 1400); };
  if (variant === 'part') {
    return (
      <Page>
        <PageHeader title={c.page} lead={c.pageLead} />
        <Panel title={c.panel}>
          <EmptyState tone="fail" compact title={c.partTitle}
            actions={<Button icon="refresh" busy={busy} onClick={retry}>{busy ? c.retrying : c.retry}</Button>}>
            <Stack gap={2}><span>{c.partBody}</span><Text size="xs" tone="muted">{c.ref}: <Hash value={reference} length={18} label={c.refLabel} /></Text></Stack>
          </EmptyState>
        </Panel>
      </Page>
    );
  }
  return (
    <AuthLayout plain brandHref="#" footer={<><a href="#status">{c.status}</a><a href="#help">{c.help}</a></>}>
      <EmptyState tone="fail" title={c.title}
        actions={<><Button variant="primary" icon="refresh" busy={busy} onClick={retry}>{busy ? c.retrying : c.retry}</Button><Button href="#projects">{c.home}</Button></>}>
        <Stack gap={4}>
          <span>{c.body}</span>
          <Text size="sm">{c.ref}: <Hash value={reference} length={18} label={c.refLabel} /></Text>
          <Disclosure title={c.details}><CodeBlock code={trace} title={c.details} /></Disclosure>
        </Stack>
      </EmptyState>
    </AuthLayout>
  );
}

En un celular

La misma página a 390 px: los botones se apilan y la referencia se parte.

Dentro de la consola

Solo el panel que falló lo dice; el encabezado de la página y el resto de la pantalla se quedan.

Tablas

Todo lo que guarda este proyecto, en tablas.

Filas escritas hoy

Cuándo usarlo

Úsalo cuando

  • Un error del servidor, un tiempo de espera agotado, un servicio caído: cualquier cosa que la persona no causó.
  • Dentro de la consola, pon el error donde irían los datos, así el resto de la pantalla sigue funcionando.

No lo uses cuando

  • Culpar a la persona, o disculparse en vez de decir qué hacer.
  • Solo códigos: «Error 503» no le dice nada a la mayoría. El código va en los detalles técnicos.
  • Reemplazar toda una pantalla de la consola porque falló un panel.

Para todos

  • El mensaje es una alerta: un lector de pantalla lo lee apenas aparece.
  • «Intentar de nuevo» muestra que está trabajando y no pierde el foco.
  • La referencia tiene su propio botón de Copiar con nombre: «Copiar referencia del error».

Props

EmptyStateTipoPor defecto
titleobligatorio

What this place is for, in one sentence of plain language.

ReactNode
actions

The one button that fills it, and at most one alternative.

ReactNode
compact boolean
icon "function" | "error" | "replay" | "performance" | "uptime" | "traces" | "rage-click" | "dead-click" | "alert" | "summary" | "watch" | "sleep" | "light" | "suggestion" | "prompt" | "mcp" | "pull-request" | "git-branch" | "fix" | "check" | "open-source" | "self-host" | "sdk" | "engine" | "signals-in" | "web" | "mobile" | "backend" | "cloud" | "data" | "user" | "clock" | "shield" | "lock" | "mail" | "star" | "copy" | "arrow-right" | "arrow-up-right" | "chevron-down" | "plus" | "close" | "play" | "pause" | "search" | "info" | "warning" | "trash" | "menu" | "download" | "upload" | "filter" | "home" | "table" | "key" | "users" | "sun" | "moon" | "globe" | "sign-out" | "link" | "edit" | "calendar" | "chevron-left" | "chevron-right" | "chevron-up" | "minus" | "more" | "sort" | "arrow-left" | "arrow-up" | "arrow-down" | "arrow-down-right" | "arrow-down-left" | "arrow-up-left" | "swap" | "swap-vertical" | "chevrons-up-down" | "chevrons-left" | "chevrons-right" | "chevrons-down" | "chevrons-up" | "enter" | "undo" | "redo" | "refresh" | "expand" | "collapse" | "fullscreen" | "fullscreen-exit" | "move" | "grip" | "more-vertical" | "trend-up" | "trend-down" | "log-in" | "external" | "slash" | "equal" | "check-small" | "close-small" | "success" | "failure" | "help" | "plus-circle" | "minus-circle" | "ban" | "pending" | "dot" | "dot-off" | "bolt" | "flag" | "pin" | "bookmark" | "heart" | "thumbs-up" | "thumbs-down" | "sparkle" | "target" | "idea" | "award" | "crown" | "bell" | "bell-off" | "bug" | "fire" | "leaf" | "file" | "file-text" | "file-code" | "file-plus" | "file-check" | "file-table" | "file-lock" | "files" | "folder" | "folder-open" | "folder-plus" | "archive" | "clipboard" | "clipboard-check" | "paperclip" | "image" | "save" | "cloud-upload" | "cloud-download" | "cloud-off" | "import" | "export" | "share" | "inbox" | "send" | "box" | "layers" | "tag" | "hash" | "at" | "qr-code" | "book" | "book-open" | "notebook" | "rows" | "columns" | "grid" | "list" | "list-ordered" | "list-checks" | "kanban" | "chart-line" | "chart-bar" | "chart-area" | "chart-parts" | "chart-scatter" | "gauge" | "funnel" | "heatmap" | "sparkline" | "percent" | "sum" | "variable" | "braces" | "brackets" | "null" | "primary-key" | "relation" | "index" | "query" | "backup" | "migrate" | "seed" | "csv" | "json" | "bold" | "italic" | "underline" | "strikethrough" | "heading" | "text" | "paragraph" | "quote" | "code" | "align-left" | "align-center" | "align-right" | "indent" | "outdent" | "unlink" | "scissors" | "eraser" | "highlight" | "duplicate" | "paste" | "wand" | "palette" | "brush" | "ruler" | "crop" | "user-plus" | "user-minus" | "user-check" | "user-x" | "user-circle" | "team" | "organization" | "id-card" | "contact" | "role" | "chat" | "chats" | "comment" | "phone" | "video" | "mic" | "mic-off" | "megaphone" | "rss" | "mail-open" | "handshake" | "wave" | "desktop" | "laptop" | "tablet" | "terminal" | "window" | "browser" | "server" | "cpu" | "memory" | "disk" | "network" | "wifi" | "wifi-off" | "plug" | "power" | "container" | "queue" | "cron" | "webhook" | "api" | "route" | "load-balancer" | "dns" | "domain" | "certificate" | "firewall" | "rocket" | "deploy" | "rollback" | "logs" | "test" | "pipeline" | "commit" | "merge" | "fork" | "release" | "environment" | "region" | "robot" | "agent" | "puzzle" | "credit-card" | "wallet" | "receipt" | "invoice" | "cart" | "bag" | "coins" | "dollar" | "gift" | "plan" | "upgrade" | "usage" | "bank" | "history" | "timer" | "hourglass" | "calendar-check" | "calendar-plus" | "map" | "compass" | "translate" | "accessibility" | "keyboard" | "pointer" | "hand" | "print" | "support" | "stop" | "record" | "skip-forward" | "skip-back" | "fast-forward" | "rewind" | "volume" | "mute" | "camera" | "zoom-in" | "zoom-out" | "eye-off" | "sliders" | "settings" | "toggle" | "sidebar-left" | "sidebar-right" | "panel-bottom" | "split" | "layout" | "dashboard" | "cards" | "density" | "dark-mode" | "theme" | "mouse" | "cursor" | "select" | "picture-in-picture" | "scan" | "unlock" | "shield-off" | "shield-alert" | "shield-user" | "password" | "fingerprint" | "two-factor" | "policy" | "incognito" | "verified" | "audit" | "secret" | "p-telemetry" | "p-cases" | "p-agent" | "p-git" | "p-data" | "p-files" | "p-run" | "p-ai" | "p-mail" | "p-domains" | "p-design" | "p-learn" | "p-skills" | "p-app" | "p-ui" light
tone "fail" | "neutral" neutral
HashTipoPor defecto
valueobligatorio string
copy boolean true
label string
length number 7
  1. En un computador
  2. En un celular
  3. Dentro de la consola
  4. Cuándo usarlo
  5. Para todos
  6. Props

    Busca páginas, secciones y términos