Skip to main content
Glama
apiUtils.ts1.23 kB
/** * Jira API utility functions * * This file contains helper functions and utilities for working with the * Jira API, including request formatting, response parsing, and common * operations that are used across multiple API endpoints. */ import { log } from '../../utils/logger' import { Failure } from '../../utils/try' import { getErrorMessage } from './errorMessageUtils' import type Try from '../../utils/try' /** * Handles API error responses * @param response The fetch response object * @param context Context info for logging * @returns The formatted error response */ export async function handleApiError(response: Response, context: string): Promise<Try<never>> { log(`handleApiError ERROR: ${context}. Status: ${response.status}`) // Parse the error response const errorData = await response.json() // Extract error message from the response if available log(`handleApiError ERROR: ${context}. Status: ${response.status} - Keys: ${JSON.stringify(Object.keys(errorData))}`) log(`handleApiError ERROR: ${context}. Status: ${response.status} - Error Data: ${JSON.stringify(errorData)}`) const errorMessage = getErrorMessage(errorData, response.status) return Failure(new Error(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/tbreeding/jira-mcp'

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