MCPcopy
hub / github.com/Fission-AI/OpenSpec / asStatus

Function asStatus

src/commands/shared-output.ts:30–45  ·  view source on GitHub ↗
(error: unknown, fallbackCode: string)

Source from the content-addressed store, hash-verified

28}
29
30export function asStatus(error: unknown, fallbackCode: string): StoreDiagnostic {
31 if (error instanceof StoreError) {
32 return error.diagnostic;
33 }
34 // RootSelectionError (and siblings) carry the same envelope without
35 // sharing a class hierarchy; duck-type the diagnostic once, here.
36 const diagnostic = (error as { diagnostic?: StoreDiagnostic }).diagnostic;
37 if (diagnostic && typeof diagnostic.code === 'string') {
38 return diagnostic;
39 }
40 return {
41 severity: 'error',
42 code: fallbackCode,
43 message: asErrorMessage(error),
44 };
45}
46
47export function emitFailure(
48 json: boolean | undefined,

Callers 2

emitFailureFunction · 0.85
failWithErrorFunction · 0.85

Calls 1

asErrorMessageFunction · 0.85

Tested by

no test coverage detected