@just-every/task
Version:
Task - A Thoughtful Task Loop
42 lines • 1.49 kB
TypeScript
/**
* Task Error Handling System
*
* Provides structured error handling for better debugging and user experience
*/
export type TaskErrorComponent = 'validation' | 'state_management' | 'thought_management';
export interface TaskErrorContext {
/** Component where the error occurred */
component: TaskErrorComponent;
/** Agent name if applicable */
agentName?: string;
/** Model ID if applicable */
modelId?: string;
/** Task description if applicable */
task?: string;
/** Additional context data */
metadata?: Record<string, any>;
}
/**
* Structured error class for Task system
*/
export declare class TaskError extends Error {
readonly component: TaskErrorComponent;
readonly agentName?: string;
readonly modelId?: string;
readonly task?: string;
readonly metadata?: Record<string, any>;
readonly originalError?: Error;
readonly timestamp: Date;
constructor(message: string, context: TaskErrorContext, originalError?: Error);
}
/**
* Validation error - thrown when input validation fails
*/
export declare class TaskValidationError extends TaskError {
constructor(message: string, context: Omit<TaskErrorContext, 'component'>, originalError?: Error);
}
/**
* Utility to wrap functions with error handling
*/
export declare function withErrorHandling<T extends (...args: any[]) => any>(fn: T, component: TaskErrorComponent, context?: Partial<TaskErrorContext>): T;
//# sourceMappingURL=errors.d.ts.map