MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / tryOrElse

Function tryOrElse

packages/plugins/mcp/src/sdk/codex-plugins.ts:170–177  ·  view source on GitHub ↗
(evaluate: () => A, orElse: A)

Source from the content-addressed store, hash-verified

168// ---------------------------------------------------------------------------
169
170const tryOrElse = <A>(evaluate: () => A, orElse: A): A => {
171 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: every fs read here is best-effort; a missing or unreadable entry is "not discoverable", not an error
172 try {
173 return evaluate();
174 } catch {
175 return orElse;
176 }
177};
178
179const listDirs = (dir: string): readonly string[] =>
180 tryOrElse(

Callers 5

listDirsFunction · 0.85
readTextFunction · 0.85
isReadableFileFunction · 0.85
isExecutableFileFunction · 0.85
readIconDataUriFunction · 0.85

Calls 1

evaluateFunction · 0.70

Tested by

no test coverage detected