Error subclass for bridge adapter failures.
const error = new BridgeError({ message: 'Bridge not ready', attempted: 'Inject bridge adapter',}); Copy
const error = new BridgeError({ message: 'Bridge not ready', attempted: 'Inject bridge adapter',});
Readonly
Returns structured context for AI agents to reason about the error.
AI-friendly context object.
Same as toJSON() but omits stack and name — AI agents don't need stack traces, and the error type is conveyed by code.
toJSON()
stack
name
code
const context = error.toAIContext();// Send to LLM for self-healing analysis Copy
const context = error.toAIContext();// Send to LLM for self-healing analysis
Serializes the error to a plain JSON-safe object.
Structured representation with all diagnostic fields.
const json = error.toJSON();logger.debug(JSON.stringify(json, null, 2)); Copy
const json = error.toJSON();logger.debug(JSON.stringify(json, null, 2));
Formats the error for human-readable console output.
Multi-line formatted string with all diagnostic sections.
console.error(error.toUserMessage()); Copy
console.error(error.toUserMessage());
Error subclass for bridge adapter failures.
Example