Files
sjw1231 71cb6c739a refactor(error): move HarnessError to the dependency-free dsh-error package
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
2026-11-05 21:26:38 +08:00

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')
})
})