MCPcopy Create free account
hub / github.com/cloudflare/computer / tryGet

Function tryGet

packages/computer/src/artifacts/cli.ts:269–279  ·  view source on GitHub ↗

Resolve a repo, returning undefined on a clean not-found miss.

(
  client: ArtifactClient,
  name: string,
)

Source from the content-addressed store, hash-verified

267
268/** Resolve a repo, returning undefined on a clean not-found miss. */
269async function tryGet(
270 client: ArtifactClient,
271 name: string,
272): Promise<ArtifactsRepoInfo | undefined> {
273 try {
274 return await client.get(name);
275 } catch (cause) {
276 if (isNotFound(cause)) return undefined;
277 throw cause;
278 }
279}
280
281/** True when a thrown error is a repo-not-found miss from either layer. */
282function isNotFound(cause: unknown): boolean {

Callers 1

runCreateFunction · 0.85

Calls 2

isNotFoundFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected