@ithena-one/mcp-governance
Version:
Governance layer (Identity, RBAC, Credentials, Audit, Logging, Tracing) for Model Context Protocol (MCP) servers.
60 lines • 2.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HandlerError = exports.CredentialResolutionError = exports.AuthorizationError = exports.AuthenticationError = exports.GovernanceError = void 0;
/**
* Base class for governance-specific errors.
*/
class GovernanceError extends Error {
constructor(message, details) {
super(message);
this.details = details;
this.name = this.constructor.name;
// Maintains proper stack trace in V8
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
}
}
exports.GovernanceError = GovernanceError;
/**
* Error indicating a failure during authentication or identity resolution.
*/
class AuthenticationError extends GovernanceError {
constructor(message = "Authentication failed", details) {
super(message, details);
}
}
exports.AuthenticationError = AuthenticationError;
/**
* Error indicating that an authenticated user is not authorized to perform an action.
*/
class AuthorizationError extends GovernanceError {
constructor(
/** Reason for denial ('identity' or 'permission'). */
reason, message = "Authorization denied", details) {
super(message, details);
this.reason = reason;
}
}
exports.AuthorizationError = AuthorizationError;
/**
* Error indicating a failure during credential resolution.
*/
class CredentialResolutionError extends GovernanceError {
constructor(message = "Failed to resolve credentials", details) {
super(message, details);
}
}
exports.CredentialResolutionError = CredentialResolutionError;
/**
* Error indicating an issue within a user-provided handler (tool, resource, prompt).
* This wraps the original error.
*/
class HandlerError extends GovernanceError {
constructor(message, originalError, details) {
super(message, details);
this.originalError = originalError;
}
}
exports.HandlerError = HandlerError;
//# sourceMappingURL=index.js.map