@zxkane/quip-mcp-server
Version:
MCP server for interacting with Quip spreadsheets
114 lines • 3.32 kB
JavaScript
;
/**
* Error handling for the Quip MCP Server
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimeoutError = exports.StorageError = exports.QuipApiError = exports.ResourceNotFoundError = exports.AuthenticationError = exports.ParseError = exports.MethodNotFoundError = exports.InvalidParamsError = exports.QuipMCPError = void 0;
/**
* Base error class for the Quip MCP Server
*/
class QuipMCPError extends Error {
constructor(message, code = -32000, data) {
super(message);
this.name = this.constructor.name;
this.code = code;
this.data = data;
// Ensure instanceof works correctly
Object.setPrototypeOf(this, QuipMCPError.prototype);
}
/**
* Convert error to JSON-RPC error object
*/
toJsonRpcError() {
const error = {
code: this.code,
message: this.message
};
if (this.data !== undefined) {
error.data = this.data;
}
return error;
}
}
exports.QuipMCPError = QuipMCPError;
/**
* Error for invalid request parameters
*/
class InvalidParamsError extends QuipMCPError {
constructor(message, data) {
super(message, -32602, data);
Object.setPrototypeOf(this, InvalidParamsError.prototype);
}
}
exports.InvalidParamsError = InvalidParamsError;
/**
* Error for method not found
*/
class MethodNotFoundError extends QuipMCPError {
constructor(method) {
super(`Method not found: ${method}`, -32601);
Object.setPrototypeOf(this, MethodNotFoundError.prototype);
}
}
exports.MethodNotFoundError = MethodNotFoundError;
/**
* Error for parse errors
*/
class ParseError extends QuipMCPError {
constructor(message = 'Parse error') {
super(message, -32700);
Object.setPrototypeOf(this, ParseError.prototype);
}
}
exports.ParseError = ParseError;
/**
* Error for authentication failures
*/
class AuthenticationError extends QuipMCPError {
constructor(message = 'Authentication failed') {
super(message, -32001);
Object.setPrototypeOf(this, AuthenticationError.prototype);
}
}
exports.AuthenticationError = AuthenticationError;
/**
* Error for resource not found
*/
class ResourceNotFoundError extends QuipMCPError {
constructor(uri) {
super(`Resource not found: ${uri}`, -32002);
Object.setPrototypeOf(this, ResourceNotFoundError.prototype);
}
}
exports.ResourceNotFoundError = ResourceNotFoundError;
/**
* Error for Quip API errors
*/
class QuipApiError extends QuipMCPError {
constructor(message, data) {
super(message, -32003, data);
Object.setPrototypeOf(this, QuipApiError.prototype);
}
}
exports.QuipApiError = QuipApiError;
/**
* Error for storage errors
*/
class StorageError extends QuipMCPError {
constructor(message, data) {
super(message, -32004, data);
Object.setPrototypeOf(this, StorageError.prototype);
}
}
exports.StorageError = StorageError;
/**
* Error for timeout errors
*/
class TimeoutError extends QuipMCPError {
constructor(message = 'Request timed out') {
super(message, -32005);
Object.setPrototypeOf(this, TimeoutError.prototype);
}
}
exports.TimeoutError = TimeoutError;
//# sourceMappingURL=errors.js.map