Files
deepseek-harness/packages/subprocess/win32-process/src/errors.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

25 lines
982 B
TypeScript

import { HarnessError } from '@deepseek-ai/dsh-error'
/** Code of every {@link Win32Error}; the failing API and its numeric code stay in `api`, `win32Code`, and `message`. */
export const WIN32_ERROR = 'WIN32_ERROR'
/** Win32 call failure with the exact API name and error code. */
export class Win32Error extends HarnessError {
/** Win32 function whose checked result failed. */
readonly api: string
/** Exact GetLastError value or direct Win32 API error code. */
readonly win32Code: number
/**
* @param api - Win32 function whose checked result failed.
* @param win32Code - exact GetLastError value or direct API error code.
* @param detail - optional subject, such as the path the call targeted.
*/
constructor(api: string, win32Code: number, detail?: string) {
super(`${api} failed (Win32 ${win32Code})${detail === undefined ? '' : `: ${detail}`}`, WIN32_ERROR)
this.name = 'Win32Error'
this.api = api
this.win32Code = win32Code
}
}