or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-3/

Promise Settlement Handler with Robust Error Recovery

Build a utility that safely processes multiple asynchronous operations, even when some promises have been tampered with or exhibit unusual error behavior. The system must handle edge cases where promise implementations are non-standard or have been modified at runtime.

Capabilities

Handles Modified Promise Behavior

  • When a promise object has a .then() method that throws an error when accessed, the system still processes that promise and returns settlement information @test
  • When multiple promises include some with throwing .then() methods mixed with normal promises, all are processed correctly @test

Captures Various Error Types

  • When promises reject with different error types (Error objects, strings, numbers), all rejection reasons are captured accurately in the result @test
  • When promises are a mix of fulfilled and rejected states, all results maintain consistent formatting with appropriate status, value, and reason fields @test

Implementation

@generates

API

/**
 * Processes an iterable of promises and returns their settlement results.
 * Handles edge cases including modified promise behavior and various error types.
 *
 * @param {Iterable} promises - An iterable of promises or values to process
 * @returns {Promise<Array>} A promise that resolves to an array of settlement results
 */
function processSettlements(promises) {
  // Implementation
}

module.exports = { processSettlements };

Dependencies { .dependencies }

promise.allsettled { .dependency }

Provides robust promise settlement tracking with advanced error handling capabilities.