Create an error from multiple errors
94
Build a utility that accepts multiple error-like values and normalizes them into standard Error instances. The utility should handle different input formats and ensure they are all properly converted to Error objects.
Your utility must accept an array containing any combination of:
message property (may include other metadata like code){message: 'text', code: 'E001'} converts them to Error instances with all properties preserved @test['error1', 'error2'] wraps each in a new Error instance @test[new Error('a'), 'b', {message: 'c'}] normalizes each according to its type @test@generates
/**
* Normalizes multiple error-like values into Error instances.
*/
class ErrorNormalizer {
/**
* Creates a new ErrorNormalizer.
* @param {Array} inputs - Array of Error instances, objects, or strings
*/
constructor(inputs);
/**
* Returns the normalized errors.
* @returns {Array<Error>} Array of Error instances
*/
get errors();
}
module.exports = ErrorNormalizer;Provides error aggregation and normalization capabilities.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-aggregate-errordocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9