Framework Errors Module
This module provides the error system for the MCP server framework. Application-specific errors should be created in app/errors/ by extending these base classes.
import { FrameworkErrorFactory, AppError, ValidationError, ErrorCodes,} from './errors/index.js';// Using the factorythrow FrameworkErrorFactory.validation.fieldRequired('name');// Using classes directlythrow new ValidationError('Invalid input', { field: 'email' });// Checking error typesif (FrameworkErrorFactory.isAppError(error)) { console.log(error.code, error.statusCode);} Copy
import { FrameworkErrorFactory, AppError, ValidationError, ErrorCodes,} from './errors/index.js';// Using the factorythrow FrameworkErrorFactory.validation.fieldRequired('name');// Using classes directlythrow new ValidationError('Invalid input', { field: 'email' });// Checking error typesif (FrameworkErrorFactory.isAppError(error)) { console.log(error.code, error.statusCode);}
Framework Errors Module
This module provides the error system for the MCP server framework. Application-specific errors should be created in app/errors/ by extending these base classes.
Example