@cnbcool/mcp-server
Version:
CNB MCP Server. A comprehensive MCP server that provides seamless integration to the CNB's API(https://cnb.cool), offering a wide range of tools for repository management, pipelines operations and collaboration features
48 lines (47 loc) • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.stopWithError = stopWithError;
exports.stopWithBadRequest = stopWithBadRequest;
exports.stopWithMethodNotAllowed = stopWithMethodNotAllowed;
exports.stopWithServerError = stopWithServerError;
function stopWithError(res, status, message) {
if (status === 400) {
stopWithBadRequest(res, message);
return;
}
if (status === 405) {
stopWithMethodNotAllowed(res, message);
return;
}
stopWithServerError(res, message);
}
function stopWithBadRequest(res, message) {
res.status(400).json({
jsonrpc: '2.0',
error: {
code: -32000,
message
},
id: null
});
}
function stopWithMethodNotAllowed(res, message) {
res.writeHead(405).end(JSON.stringify({
jsonrpc: '2.0',
error: {
code: -32000,
message
},
id: null
}));
}
function stopWithServerError(res, message) {
res.status(500).json({
jsonrpc: '2.0',
error: {
code: -32603,
message
},
id: null
});
}