error.ts

Error-message normalization.

to_error_message is the single primitive for coercing an unknown caught value to a human-readable string — value.message for an Error, otherwise a caller-supplied fallback or String(value). Used wherever a catch (err) binding (typed unknown) feeds a diagnostic message, log line, or error field, replacing the inline err instanceof Error ? err.message : String(err) idiom.

view source

Declarations
#

to_error_message
#

error.ts view source

(value: unknown, fallback?: string | undefined): string import {to_error_message} from 'svelte-docinfo/error.js';

Extract a human-readable message from an unknown thrown value.

value

type unknown

fallback?

type string | undefined
optional

returns

string

Imported by
#