Common utilities for error handling within Backstage with structured error classes and serialization functions
63
Helpers to validate and collect error-like values thrown from unknown sources.
[new Error("boom"), { name: "RemoteFailure", message: "503" }, null, { message: "ignored" }, 7] returns two Error objects where the first is the original error and the second has name "RemoteFailure" and message "503" @test@generates
export function ensureError(value: unknown): Error;
/**
* Normalizes an array of unknown values into real Error objects,
* skipping any entries that are not error-like.
*/
export function collectErrors(values: unknown[]): Error[];Provides utilities for guarding and asserting error-shaped values when handling unknown failures. @satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-backstage--errorsevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10