1.7 KiB
1.7 KiB
Taskbuffer Hints
Error Handling (v3.6.0+)
Tasknow hascatchErrorsconstructor option (default:false)- Default behavior:
trigger()rejects when taskFunction throws (breaking change from pre-3.6) - Set
catchErrors: trueto swallow errors (old behavior) - returnsundefinedon error - Error state tracked via
lastError?: Error,errorCount: number,clearError() getMetadata()status uses all four values:'idle'|'running'|'completed'|'failed'- All peripheral classes (Taskchain, Taskparallel, TaskRunner, BufferRunner, TaskDebounced, TaskManager) have proper error propagation/handling
console.logcalls replaced withlogger.log()throughout
Breaking API Rename (TaskRunner)
maxParrallelJobs→maxParallelJobsqeuedTasks→queuedTasks- JSDoc typos fixed: "qeue" → "queue", "wether" → "whether", "loose" → "lose"
- The
setMaxParallelJobs()parameter also renamed frommaxParrallelJobsArgtomaxParallelJobsArg
Error Context Improvements
- TaskChain: Errors now wrap the original with context: chain name, failing task name, and task index. Original error preserved via
.cause - BufferRunner: When
catchErrors: false, buffered task errors now reject the trigger promise (viaCycleCounter.informOfCycleError) instead of silently resolving withundefined - TaskChain stubs completed:
removeTask(task)returnsboolean,shiftTask()returnsTask | undefined
Project Structure
- Source in
ts/, web components ints_web/ - Tests in
test/- naming:*.node.ts,*.browser.ts,*.both.ts - Logger:
ts/taskbuffer.logging.tsexportslogger(ConsoleLog from smartlog) - Build:
pnpm build(tsbuild tsfolders) - Test:
pnpm testortstest test/test.XX.name.ts --verbose