All components (283)
Stack trace
AI · StackTrace
What it is and when to use it
A stack trace to read: the error message, its frames with the function and the location, and those of dependencies set aside behind a button.
When to use it
- Showing a code error to whoever debugs it: from an agent, a test or a service.
stackis the text as the engine gives it (V8, Firefox and Safari). WithonOpenFrame, the location of each own frame is a button to open the file.- Frames from
node_modulesand from the engine are set aside and shown with a button.
When not to
- An error message for the end user:
Alert. - A fragment of code:
CodeBlock. - The log of a run:
ActivityLog.
Keyboard: the title folds and opens; Tab goes through the copy button, the frames that can be opened and the one that shows the internal ones.
Accessibility: the frames are a list; the internal ones are told apart by tone and by being set aside. Copying says so with text in a live region.
Fine-tuning: amset-stacktrace and the amset-stacktrace__* classes.
What it looks like
- sendReminderlikely origin/app/src/reminders.ts:42:18
- processInvoice/app/src/invoices.ts:118:5
<StackTrace stack={error.stack} defaultExpanded />Props
Import it with import { StackTrace } from '@amset/ui'. Required props are marked.
| Prop | Type | What it does |
|---|---|---|
stackrequired | string | The trace as the engine gives it: the error message and its frames below. |
className | string | Merged with the library classes; it does not replace them. |
defaultExpanded | boolean | Open at the start. Yes by default: whoever looks at a trace comes to read it. |
onOpenFrame | (frame: StackFrame) => void | If given, the location of each own frame is a button that calls this (open the file in the editor). |
It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.
In the test bench
Every state and variant, to try one at a time, on its page at storybook.amsetui.com:
