- 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
20 lines
770 B
TypeScript
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'
|
|
}
|
|
}
|