chore: initialize qiming workspace repository
This commit is contained in:
47
qimingclaw/crates/qiming-mcp-stdio-proxy/src/errors.ts
Normal file
47
qimingclaw/crates/qiming-mcp-stdio-proxy/src/errors.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Unified error types for qiming-mcp-stdio-proxy
|
||||
*
|
||||
* Provides structured error handling across all modules.
|
||||
*/
|
||||
|
||||
/** Connection error - used for transport layer connection failures */
|
||||
export class ConnectionError extends Error {
|
||||
constructor(
|
||||
public readonly serverId: string,
|
||||
public readonly cause: Error,
|
||||
) {
|
||||
super(`Connection failed for "${serverId}": ${cause.message}`);
|
||||
this.name = 'ConnectionError';
|
||||
}
|
||||
}
|
||||
|
||||
/** Tool call error - used for tool execution failures */
|
||||
export class ToolCallError extends Error {
|
||||
constructor(
|
||||
public readonly toolName: string,
|
||||
public readonly serverId: string | undefined,
|
||||
public readonly cause: Error,
|
||||
) {
|
||||
super(`Tool "${toolName}" call failed: ${cause.message}`);
|
||||
this.name = 'ToolCallError';
|
||||
}
|
||||
}
|
||||
|
||||
/** Health check error - used for heartbeat detection failures */
|
||||
export class HealthCheckError extends Error {
|
||||
constructor(
|
||||
public readonly serverId: string,
|
||||
public readonly consecutiveFailures: number,
|
||||
) {
|
||||
super(`Health check failed for "${serverId}" (${consecutiveFailures} consecutive failures)`);
|
||||
this.name = 'HealthCheckError';
|
||||
}
|
||||
}
|
||||
|
||||
/** Configuration error - used for config validation failures */
|
||||
export class ConfigError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'ConfigError';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user