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.
Import:
import { createAggregateError } from 'obsidian-dev-utils/aggregate-error';Signature:
function createAggregateError(errors: readonly unknown[]): AggregateErrorParameters:
| Parameter | Type | Description |
|---|---|---|
errors |
readonly unknown[] | The collected errors to aggregate. |
Returns: AggregateError — An AggregateError holding every collected error, with a non-empty message.
Links to this page:
- CommandHandlerComponent
- AbortSignalComponent
- AllWindowsEventComponent
- AsyncErrorHandlerComponent
- CaseInsensitiveFileIndexComponent
- ComponentEx
- ConsoleDebugComponent
- CorePluginToggleComponent
- EmbedExtensionsComponent
- GenerateMarkdownLinkDefaultParamsComponent
- CallbackLayoutReadyComponent
- LayoutReadyComponent
- MenuEventRegistrarComponent
- MonkeyAroundComponent
- NotebookNavigatorMenuEventRegistrarComponent
- PluginContextComponent
- PluginGateComponent
- PluginNoticeComponent
- PluginSettingsComponentBase
- PluginSettingsTabComponent
- PluginSuggestionComponent
- PointerPositionComponent
- RegistryComponent
- ReleaseNotesComponent
- RenameDeleteHandlerComponent
- RmdirGuardComponent
- SettingsMigrationComponent
- SyntaxHighlightingComponent
- TemplatesLanguageComponent
- ResourceLockComponent