Files
deepseek-harness/packages/shell/shell-env/src/error.ts
T
sjw1231 690634f5e9 refactor(errors): base the new shell, sandbox, and subprocess errors on dsh-error
The error classes this branch adds import HarnessError from the
dependency-free @deepseek-ai/dsh-error package: Win32Error,
SubprocessError, and ShellEnvError packages depend on dsh-error instead
of the LLM runtime, and dsh-sandbox and dsh-working-directory declare it
beside their existing dsh-llm dependency. The SHELL_ENV and
WORKING_DIRECTORY code lists stay in internal modules so the plugin
entries export only the error classes and code types. Generated module,
config, and event graphs follow.

Refs #7869
2026-11-06 16:39:37 +08:00

29 lines
1013 B
TypeScript

/** Machine-routable shell environment failures. @module */
import { HarnessError } from '@deepseek-ai/dsh-error'
/**
* Every {@link ShellEnvError} code:
* - `SHELL_ENV_CONTRIBUTION_INVALID` — a registered contributor returned an undeclared key or a non-string value; the
* shell command does not run, and the contributing plugin must be fixed.
*/
export const SHELL_ENV_ERROR_CODES = ['SHELL_ENV_CONTRIBUTION_INVALID'] as const
/** One code from {@link SHELL_ENV_ERROR_CODES}. */
export type ShellEnvErrorCode = typeof SHELL_ENV_ERROR_CODES[number]
/** Shell environment failure carrying a stable {@link ShellEnvErrorCode}. */
export class ShellEnvError extends HarnessError {
override readonly code: ShellEnvErrorCode
/**
* @param message - names the contributor and the offending key.
* @param code - the failure class consumers route on.
*/
constructor(message: string, code: ShellEnvErrorCode) {
super(message, code)
this.name = 'ShellEnvError'
this.code = code
}
}