extractErrorMessage
Coerce an unknown error value into a human-readable message string — reads
.message from Errors, returns strings as-is, and String()-casts the
rest. Useful when rendering an agent's error outside the built-in
chat-error component.
import { extractErrorMessage } from '@threadplane/chat';Declaration · overload 1
export declare function extractErrorMessage(error: unknown): string | null;Parameters
error· requiredunknownAny caught/agent error value.
Returns
string | nullThe message text, or null when error is nullish.
Examples
const msg = extractErrorMessage(agent.error());