Files
deepseek-harness/packages/document/office-kit/src/errors.ts
T
sjw1231 8b0d709104 refactor(office): address review on Office tool error classification
- Document the argument and filesystem failure text in the Model Experience
  section of the tool-office README.
- Pin the invalid arguments prefix with full-text assertions.
- Assert the OfficeKitError cause for an absent Office service, and check the
  agentless refusal in one execution.
- Keep OfficeToolError internal; the entry exports only its code type.
- Limit the OfficeKitError JSDoc to the wire and localization role of its code.

Refs #7869
2026-11-09 16:08:19 +08:00

20 lines
770 B
TypeScript

/** Classified failures shared by conversion and its consumers. */
import type { OfficeKitErrorCode } from './types.ts'
/**
* Classified conversion failure; engine details stay in the cause. The same lowercase `code` is the
* `document-render/failed` reason the Office preview localizes, so its spelling is a wire value and a client
* localization key.
*/
export class OfficeKitError extends Error {
/**
* @param code - category suitable for a conversion consumer.
* @param message - diagnostic explaining the failed conversion.
* @param options - underlying engine or filesystem failure.
*/
constructor(readonly code: OfficeKitErrorCode, message: string, options?: ErrorOptions) {
super(message, options)
this.name = 'OfficeKitError'
}
}