Resolve a repo, returning undefined on a clean not-found miss.
( client: ArtifactClient, name: string, )
| 267 | |
| 268 | /** Resolve a repo, returning undefined on a clean not-found miss. */ |
| 269 | async 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. */ |
| 282 | function isNotFound(cause: unknown): boolean { |
no test coverage detected