TypeTags .AggregateError
Overview
The AggregateError
object represents an error when several errors need to be wrapped in a single error. It is thrown when multiple errors need to be reported by an operation, for example by Promise.any()
, when all promises passed to it reject.
Usage
import { TypeTags } from 'typetags'
Promise.any([Promise.reject(new Error('some error'))]).catch((e) => { console.log(e instanceof AggregateError) // true})
console.log(TypeTags.AggregateError)// → [object Error]
TypeTags.get(new AggregateError([]))// → [object Error]
Predicate
.isAggregateError(value)
️🚫
Since error objects do not have unique type tags, an AggregateError
type
tag is the same as any other Error
object. If you need to check if an error
is an instance of an AggregateError
, use instanceof
instead.
- Checks if
value
is or has a defaultAggregateError
type tag.
const { TypeTags } = require('typetags')
let error = new AggregateError([])
TypeTags.isAggregateError(error)// → true
TypeTags.get(error)// → [object AggregateError]
Metadata (TType)
Metadata | Value |
---|---|
.type | AggregateError |
.tag | [object Error] |
.builtin() | undefined |
.getTag() | [object Error] |
.hasSpecialArgs() | true |
.instance() | undefined |
.instanceTypeOf() | object |
.info() | see more |
.isAvailable() | true |
.isConstructor() | true |
.isFactory() | true |
.isFunction() | true |
.isGlobal() | true |
.isIterator() | false |
.isNested() | false |
.isObject() | false |
.isPrimitive() | false |
.isStringifiable() | true |
.isSyntatic() | false |
.isTypedArray() | false |
.ownKeys() | [length, name, prototype] |
.toString() | function toString() { [native code] } |
.typeOf() | function |
Signature
declare type ITypeTags = { [key in Types | NestedTypes]: Tags}
declare interface Predicate { predicate(value: any): boolean}