dsh-llm depends on dsh-attachment and dsh-typert-protocol, so classes in those packages could not extend a base defined in dsh-llm without a project-reference cycle. HarnessError now lives in @deepseek-ai/dsh-error, which has no dependencies; dsh-llm declares it as a peer and re-exports the same class, so existing imports and instanceof checks keep working. The Agent Note records why the original leaf-package placement no longer holds. Refs #7869
20 lines
721 B
TypeScript
20 lines
721 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { HarnessError } from '../src/index.ts'
|
|
|
|
class SampleError extends HarnessError {}
|
|
|
|
describe('HarnessError', () => {
|
|
it('carries a code, a cause, and the constructing class name', () => {
|
|
const cause = new Error('underlying failure')
|
|
const error = new SampleError('operation failed', 'SAMPLE_FAILED', { cause })
|
|
|
|
expect(error).toBeInstanceOf(Error)
|
|
expect(error).toBeInstanceOf(HarnessError)
|
|
expect(error).toMatchObject({ name: 'SampleError', code: 'SAMPLE_FAILED', message: 'operation failed', cause })
|
|
})
|
|
|
|
it('names a direct instance HarnessError', () => {
|
|
expect(new HarnessError('failed', 'FAILED').name).toBe('HarnessError')
|
|
})
|
|
})
|