MCPcopy Create free account
hub / github.com/arctic-cli/interface / ErrorComponent

Function ErrorComponent

packages/arctic/src/cli/cmd/tui/app.tsx:965–1037  ·  view source on GitHub ↗
(props: {
  error: Error
  reset: () => void
  onExit: () => Promise<void>
  mode?: "dark" | "light"
})

Source from the content-addressed store, hash-verified

963}
964
965function ErrorComponent(props: {
966 error: Error
967 reset: () => void
968 onExit: () => Promise<void>
969 mode?: "dark" | "light"
970}) {
971 const term = useTerminalDimensions()
972 useKeyboard((evt) => {
973 if (evt.ctrl && evt.name === "c") {
974 props.onExit()
975 }
976 })
977 const [copied, setCopied] = createSignal(false)
978
979 const issueURL = new URL("https://github.com/arctic-cli/interface/issues/new?template=bug-report.yml")
980
981 // Choose safe fallback colors per mode since theme context may not be available
982 const isLight = props.mode === "light"
983 const colors = {
984 bg: isLight ? "#ffffff" : "#0a0a0a",
985 text: isLight ? "#1a1a1a" : "#eeeeee",
986 muted: isLight ? "#8a8a8a" : "#808080",
987 primary: isLight ? "#3b7dd8" : "#fab283",
988 }
989
990 if (props.error.message) {
991 issueURL.searchParams.set("title", `opentui: fatal: ${props.error.message}`)
992 }
993
994 if (props.error.stack) {
995 issueURL.searchParams.set(
996 "description",
997 "```\n" + props.error.stack.substring(0, 6000 - issueURL.toString().length) + "...\n```",
998 )
999 }
1000
1001 issueURL.searchParams.set("arctic-version", Installation.VERSION)
1002
1003 const copyIssueURL = () => {
1004 Clipboard.copy(issueURL.toString()).then(() => {
1005 setCopied(true)
1006 })
1007 }
1008
1009 return (
1010 <box flexDirection="column" gap={1} backgroundColor={colors.bg}>
1011 <box flexDirection="row" gap={1} alignItems="center">
1012 <text attributes={TextAttributes.BOLD} fg={colors.text}>
1013 Please report an issue.
1014 </text>
1015 <box onMouseUp={copyIssueURL} backgroundColor={colors.primary} padding={1}>
1016 <text attributes={TextAttributes.BOLD} fg={colors.bg}>
1017 Copy issue URL (exception info pre-filled)
1018 </text>
1019 </box>
1020 {copied() && <text fg={colors.muted}>Successfully copied</text>}
1021 </box>
1022 <box flexDirection="row" gap={2} alignItems="center">

Callers

nothing calls this directly

Calls 1

setMethod · 0.45

Tested by

no test coverage detected