MCPcopy Create free account
hub / github.com/agenticsorg/edge-agents / handleError

Function handleError

scripts/sparc-bench/src/utils/error-handler.ts:30–50  ·  view source on GitHub ↗
(error: unknown, verbose = false)

Source from the content-addressed store, hash-verified

28 * @param verbose Whether to show verbose output
29 */
30export function handleError(error: unknown, verbose = false): never {
31 if (error instanceof SparcBenchError) {
32 console.error(`[${error.code}] ${error.message}`);
33
34 if (verbose && error.stack) {
35 console.error("\nStack trace:");
36 console.error(error.stack);
37 }
38 } else if (error instanceof Error) {
39 console.error(`[ERROR] ${error.message}`);
40
41 if (verbose && error.stack) {
42 console.error("\nStack trace:");
43 console.error(error.stack);
44 }
45 } else {
46 console.error("[ERROR] An unknown error occurred:", error);
47 }
48
49 Deno.exit(1);
50}
51
52/**
53 * Try to execute a function and handle any errors

Callers 2

runCliFunction · 0.90
cli.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected