MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / getDetail

Method getDetail

src/lib/errors.ts:185–194  ·  view source on GitHub ↗

* Type-safe accessor for a single key inside `details`. Avoids the * `(err.details as { foo?: unknown })?.foo` cast pattern that every * 412 / CONFLICT handler had to repeat. * * @param key The key to read from `details`. * @param validator Optional type-guard. When provided, retu

(key: string, validator?: (v: unknown) => v is T)

Source from the content-addressed store, hash-verified

183 * );
184 */
185 getDetail<T = unknown>(key: string, validator?: (v: unknown) => v is T): T | undefined {
186 const details = this.details;
187 if (details === undefined || details === null || typeof details !== 'object') {
188 return undefined;
189 }
190 const value = (details as Record<string, unknown>)[key];
191 if (value === undefined) return undefined;
192 if (validator && !validator(value)) return undefined;
193 return value as T;
194 }
195
196 /**
197 * Local fabrication of a missing-key error. Wording matches the server

Callers 9

index.tsFile · 0.80
isTransientRateLimitFunction · 0.80
triggerOneFunction · 0.80
runCodePutFunction · 0.80
runTestRunFunction · 0.80
runTestRerunFunction · 0.80
test.rerun.spec.tsFile · 0.80
pollRunUntilTerminalFunction · 0.80
errors.test.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected