mirror of
https://github.com/stablyai/orca.git
synced 2026-10-27 16:02:42 +00:00
33 lines
872 B
TypeScript
33 lines
872 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { mapRuntimeError } from './errors'
|
|
|
|
class LineageError extends Error {
|
|
code = 'LINEAGE_PARENT_NOT_FOUND'
|
|
data = {
|
|
nextSteps: ['Run `orca worktree list`.', 'Retry with --no-parent.']
|
|
}
|
|
}
|
|
|
|
describe('mapRuntimeError', () => {
|
|
it('preserves structured lineage error codes and data for CLI recovery hints', () => {
|
|
const response = mapRuntimeError(
|
|
'req_1',
|
|
{ runtimeId: 'runtime-1' },
|
|
new LineageError('Parent workspace was not found.')
|
|
)
|
|
|
|
expect(response).toEqual({
|
|
id: 'req_1',
|
|
ok: false,
|
|
error: {
|
|
code: 'LINEAGE_PARENT_NOT_FOUND',
|
|
message: 'Parent workspace was not found.',
|
|
data: {
|
|
nextSteps: ['Run `orca worktree list`.', 'Retry with --no-parent.']
|
|
}
|
|
},
|
|
_meta: { runtimeId: 'runtime-1' }
|
|
})
|
|
})
|
|
})
|