Skip to main content
Glama

MCP Claude Spotify

Mozilla Public License 2.0
16
  • Apple
  • Linux
errors.js2.33 kB
/** * Custom error classes for better error handling * * This file defines custom error classes for the application * to provide more context and better error handling. */ /** * Base error class for the application */ export class SpotifyMCPError extends Error { constructor(message) { super(message); this.name = 'SpotifyMCPError'; } } /** * Error thrown when authentication fails */ export class AuthenticationError extends SpotifyMCPError { constructor(message) { super(message); this.name = 'AuthenticationError'; } } /** * Error thrown when an API request fails */ export class APIError extends SpotifyMCPError { status; data; constructor(message, status, data) { super(message); this.name = 'APIError'; this.status = status; this.data = data; } } /** * Error thrown when validation fails */ export class ValidationError extends SpotifyMCPError { errors; constructor(message, errors = []) { super(message); this.name = 'ValidationError'; this.errors = errors; } } /** * Error thrown when a tool is not found */ export class ToolNotFoundError extends SpotifyMCPError { toolName; constructor(toolName) { super(`Unknown tool: ${toolName}`); this.name = 'ToolNotFoundError'; this.toolName = toolName; } } /** * Error thrown when a playback command fails */ export class PlaybackError extends SpotifyMCPError { constructor(message) { super(message); this.name = 'PlaybackError'; } } /** * Error thrown when the auth server port is already in use */ export class ServerAlreadyRunningError extends SpotifyMCPError { port; constructor(port) { super(`Server already running on port ${port}`); this.name = 'ServerAlreadyRunningError'; this.port = port; } } /** * Helper to format error messages */ export function formatError(error) { if (error instanceof ValidationError && error.errors.length > 0) { return `${error.message}: ${error.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', ')}`; } if (error instanceof APIError && error.status) { return `API Error (${error.status}): ${error.message}`; } return error.message || String(error); }

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/imprvhub/mcp-claude-spotify'

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