Skip to main content
Glama
MikelA92
by MikelA92
MetabaseError.js2.25 kB
/** * Base error class for Metabase MCP Server */ export class MetabaseError extends Error { constructor(message, code = 'METABASE_ERROR', details = {}) { super(message); this.name = 'MetabaseError'; this.code = code; this.details = details; this.timestamp = new Date().toISOString(); // Maintains proper stack trace for where our error was thrown Error.captureStackTrace(this, this.constructor); } toJSON() { return { name: this.name, code: this.code, message: this.message, details: this.details, timestamp: this.timestamp, }; } } /** * API-related errors (network, HTTP errors, etc.) */ export class ApiError extends MetabaseError { constructor(message, statusCode, endpoint, responseText = '') { super(message, 'API_ERROR', { statusCode, endpoint, responseText }); this.name = 'ApiError'; this.statusCode = statusCode; this.endpoint = endpoint; this.responseText = responseText; } } /** * Validation errors (invalid input parameters) */ export class ValidationError extends MetabaseError { constructor(message, field, value) { super(message, 'VALIDATION_ERROR', { field, value }); this.name = 'ValidationError'; this.field = field; this.value = value; } } /** * Configuration errors (missing env vars, invalid config) */ export class ConfigurationError extends MetabaseError { constructor(message, configKey) { super(message, 'CONFIGURATION_ERROR', { configKey }); this.name = 'ConfigurationError'; this.configKey = configKey; } } /** * Tool execution errors */ export class ToolExecutionError extends MetabaseError { constructor(message, toolName, originalError) { super(message, 'TOOL_EXECUTION_ERROR', { toolName, originalError: originalError?.message }); this.name = 'ToolExecutionError'; this.toolName = toolName; this.originalError = originalError; } } /** * Timeout errors */ export class TimeoutError extends MetabaseError { constructor(message, operation, timeoutMs) { super(message, 'TIMEOUT_ERROR', { operation, timeoutMs }); this.name = 'TimeoutError'; this.operation = operation; this.timeoutMs = timeoutMs; } }

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/MikelA92/metabase-mcp-mab'

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