Skip to main content
Glama
AutoLoadError.ts1.67 kB
/** * AutoLoadError - Structured error type for auto-load memory failures * * Provides detailed context about memory auto-load failures including: * - Memory name that failed * - Phase where failure occurred (load/validate/budget) * - Descriptive error message * * Factory methods provide convenient creation for common scenarios. */ export class AutoLoadError extends Error { public readonly memoryName: string; public readonly phase: 'load' | 'validate' | 'budget'; constructor( message: string, memoryName: string, phase: 'load' | 'validate' | 'budget' ) { super(message); this.name = 'AutoLoadError'; this.memoryName = memoryName; this.phase = phase; // Maintains proper stack trace for where error was thrown if (Error.captureStackTrace) { Error.captureStackTrace(this, AutoLoadError); } } /** * Create error for memory load failures */ static loadFailed(memoryName: string, reason: string): AutoLoadError { return new AutoLoadError( `Failed to load memory: ${reason}`, memoryName, 'load' ); } /** * Create error for memory validation failures */ static validationFailed(memoryName: string, reason: string): AutoLoadError { return new AutoLoadError( `Memory validation failed: ${reason}`, memoryName, 'validate' ); } /** * Create error for budget constraint violations */ static budgetExceeded(memoryName: string, tokens: number, budget: number): AutoLoadError { return new AutoLoadError( `Memory exceeds token budget (${tokens} > ${budget} tokens)`, memoryName, 'budget' ); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DollhouseMCP/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server