Skip to main content
Glama
api.errors.ts1.08 kB
// A base class for all your application's operational errors export class AppError extends Error { public readonly details: unknown; constructor(message: string, details?: unknown) { super(message); this.name = this.constructor.name; this.details = details; Error.captureStackTrace(this, this.constructor); } } // A specific error for YouTube API failures export class YouTubeApiError extends AppError { constructor(message: string, originalError: unknown) { // Extract key details from the original Google API error const details = hasResponseData(originalError) ? originalError.response.data : originalError; super(message, details); this.name = "YouTubeApiError"; } } // Helper to check the structure of the Google API error const hasResponseData = ( error: unknown ): error is { response: { data: unknown } } => { return ( error !== null && typeof error === "object" && "response" in error && error.response !== null && typeof error.response === "object" && "data" in error.response ); };

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/kirbah/mcp-youtube'

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