Skip to main content
Glama
MetadataErrorService.test.ts1.25 kB
import { describe, it, expect } from 'vitest'; import { DefaultMetadataErrorService } from '../../../src/services/metadata/MetadataErrorService.js'; const service = new DefaultMetadataErrorService(); describe('DefaultMetadataErrorService', () => { it('throws structured error for axios-style responses', () => { const axiosError = { response: { status: 404, data: { error: { message: 'Not found', }, }, }, }; try { service.toStructuredError('companies', axiosError); throw new Error('Expected structured error'); } catch (error) { expect(error).toMatchObject({ status: 404, body: { code: 'api_error', message: expect.stringContaining('Not found'), }, }); } }); it('throws generic error for unexpected failures', () => { expect(() => service.toStructuredError('people', new Error('boom')) ).toThrowError('Failed to discover people attributes: boom'); }); it('wraps record fetch errors', () => { expect(() => service.toRecordFetchError('companies', '123', new Error('missing')) ).toThrowError('Failed to get record attributes: missing'); }); });

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/kesslerio/attio-mcp-server'

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