Jaspers Hub

jaspers / agents

pluginOfficialReviewed★ 0↓ 0

Research Agents: Lets you define research agents that chat and answer with citations from SEC filings, your documents, and the web, via Jaspers' research-store service.

625 B
1// An error's words, whichever realm made it. This plugin's code runs in its own vm, so an Error the
2// app creates (an abort's reason, a rejected call) is not `instanceof Error` here, and String() of it
3// would lose its message or put "Error: " in front.
4
5export function errorText(value: unknown, fallback = 'stopped'): string {
6 if (typeof value === 'string') return value
7 if (typeof value === 'object' && value !== null && typeof (value as { message?: unknown }).message === 'string') {
8 return (value as { message: string }).message
9 }
10 return value === undefined || value === null ? fallback : String(value)
11}