Skip to main content
Glama
index.ts1.11 kB
export abstract class ExtendableError extends Error { name: string; private _error: Error; private _stack: string; constructor( public message = '', ) { super(message); Object.setPrototypeOf(this, new.target.prototype); delete (<Error>this).stack; this.name = new.target.name; this._error = new Error(); } get stack(): string { if (this._stack) { return this._stack; } let prototype = Object.getPrototypeOf(this); let depth = 1; loop: while (prototype) { switch (prototype) { case ExtendableError.prototype: break loop; case Object.prototype: depth = 1; break loop; default: depth++; break; } prototype = Object.getPrototypeOf(prototype); } let stackLines = (this._error.stack || '').match(/.+/g) || []; let nameLine = this.name; if (this.message) { nameLine += `: ${this.message}`; } stackLines.splice(0, depth + 1, nameLine); return this._stack = stackLines.join('\n'); } } export default ExtendableError;

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/ajaystream/hubspot-mcp-custom'

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