CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-aggregate-error

Create an error from multiple errors

94

1.28x
Overview
Eval results
Files

task.mdevals/scenario-2/

Batch Validation Error Aggregator

A utility for collecting and consolidating validation errors from different sources into a single error object for reporting.

Capabilities

Accepts Error instances

  • When provided with an array containing an Error instance, it stores the error without modification @test

Accepts string values

  • When provided with an array containing a string value, it converts the string into an error object @test

Accepts plain objects

  • When provided with an array containing a plain object with a message property, it converts the object into an error while preserving all object properties @test

Handles mixed input types

  • When provided with an array containing Error instances, strings, and plain objects together, it processes all inputs correctly and stores them as error objects @test

Implementation

@generates

API

/**
 * Creates a validation error aggregator that collects multiple errors.
 *
 * @param {Array<Error|string|object>} errors - Array of errors in various formats
 * @returns {Object} An object with an 'errors' property containing normalized Error instances
 */
function createValidationAggregator(errors) {
  // IMPLEMENTATION HERE
}

module.exports = { createValidationAggregator };

Dependencies { .dependencies }

aggregate-error { .dependency }

Provides error aggregation functionality

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-aggregate-error

tile.json