Skip to main content
Glama
getExceptionMessage.test.ts1.04 kB
import { getExceptionMessage } from './getExceptionMessage.js'; describe('getExceptionMessage', () => { it('should return error message for Error objects', () => { const error = new Error('Test error message'); expect(getExceptionMessage(error)).toBe('Test error message'); }); it('should return stringified JSON for serializable objects', () => { const obj = { key: 'value', number: 123 }; expect(getExceptionMessage(obj)).toBe('{"key":"value","number":123}'); }); it('should return string representation for non-serializable objects', () => { const circular: any = {}; circular.self = circular; expect(getExceptionMessage(circular)).toBe('[object Object]'); }); it('should handle primitive values', () => { expect(getExceptionMessage('string')).toBe('"string"'); expect(getExceptionMessage(123)).toBe('123'); expect(getExceptionMessage(true)).toBe('true'); expect(getExceptionMessage(null)).toBe('null'); expect(getExceptionMessage(undefined)).toBe('undefined'); }); });

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/datalabs89/tableau-mcp'

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