Skip to main content
Glama
AppError.swift866 B
import Foundation import FlyingFox enum AppErrorType: String, Codable { case `internal` case precondition case timeout } struct AppError: Error, Codable { let type: AppErrorType let message: String private var statusCode: HTTPStatusCode { switch type { case .internal: return .internalServerError case .precondition: return .badRequest case .timeout: return .requestTimeout } } var httpResponse: HTTPResponse { let body = try? JSONEncoder().encode(self) return HTTPResponse(statusCode: statusCode, body: body ?? Data()) } init(type: AppErrorType = .internal, message: String) { self.type = type self.message = message } private enum CodingKeys : String, CodingKey { case type = "code" case message = "errorMessage" } }

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/mobile-dev-inc/Maestro'

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