Error Handling in Async Code
What error handling threshold pattern is implemented?
class AsyncOperationQueue {
constructor() {
this.errors = [];
this.results = [];
}
async addOperation(operation) {
try {
const result = await operation();
this.results.push(result);
} catch (error) {
this.errors.push(error);
if (this.errors.length >= 3) {
throw new AggregateError(this.errors, 'Too many operations failed');
}
}
}
}