MCPcopy Create free account
hub / github.com/modem-dev/hunk / formatCliError

Function formatCliError

src/core/errors.ts:12–32  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

10
11/** Format CLI and startup failures without exposing Bun internal stack frames for expected errors. */
12export function formatCliError(error: unknown) {
13 if (error instanceof HunkUserError) {
14 const lines = [`hunk: ${error.message}`];
15
16 if (error.details.length > 0) {
17 lines.push("", ...error.details);
18 }
19
20 return `${lines.join("\n")}\n`;
21 }
22
23 if (error instanceof Error) {
24 if (process.env.HUNK_DEBUG === "1" && error.stack) {
25 return `${error.stack}\n`;
26 }
27
28 return `hunk: ${error.message}\n`;
29 }
30
31 return `hunk: ${String(error)}\n`;
32}

Callers 2

main.tsxFile · 0.90
errors.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected