Skip to content

aggregate-error

Contains a utility function for building an AggregateError that names what failed.

Function Description
createAggregateError Builds an AggregateError over collected errors, giving it a message that names what failed. AggregateError’s own message is optional, and omitting it is lossy in a way that only shows up outside this library. error!errorToString walks errors and prints the whole tree, so the console is fine; everything that reads message is not. Obsidian’s own plugin-load failure report, a Notice built from an error, and a consumer’s rejects.toThrow(message) all see an empty string and read it as “nothing was thrown”. Nesting compounds it: an aggregate holding one aggregate puts two empty layers above the only sentence that says what went wrong. A single collected error therefore lends its own message to the aggregate, which makes a one-cause chain read identically at every level. Several become a count, with the detail one level down where error!errorToString already prints it.