Skip to main content
Glama
rizaqpratama

CucumberStudio MCP Server

by rizaqpratama
errorHandler.js1.07 kB
const { logger } = require('../utils/logger'); /** * Custom error class for API errors */ class ApiError extends Error { constructor(message, statusCode, code = 'API_ERROR') { super(message); this.statusCode = statusCode; this.code = code; this.name = this.constructor.name; Error.captureStackTrace(this, this.constructor); } } /** * Not found error handler */ const notFound = (req, res, next) => { const error = new ApiError(`Not Found - ${req.originalUrl}`, 404, 'NOT_FOUND'); next(error); }; /** * Global error handler */ const errorHandler = (err, req, res, next) => { const statusCode = err.statusCode || 500; const code = err.code || 'INTERNAL_SERVER_ERROR'; logger.error(`Error: ${err.message}`); if (process.env.NODE_ENV === 'development') { logger.error(err.stack); } res.status(statusCode).json({ error: { message: err.message, code, ...(process.env.NODE_ENV === 'development' && { stack: err.stack }) } }); }; module.exports = { ApiError, notFound, errorHandler };

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/rizaqpratama/mcp-cucumberstudio'

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