Enhance error handling with categorization and helpful suggestions #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch ":feat/better-errors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
This PR significantly improves error handling in the Midjourney MCP server by adding error categorization, helpful suggestions, and better user guidance.
Changes
New Features
Error Categorization
ErrorCategoryenum with types:content_filter- Content policy violationsapi_error- API-specific errorsnetwork_error- Connection/network issuestimeout- Request timeoutsvalidation_error- Invalid parametersunknown- Uncategorized errorsEnhanced MidAPIError Class
retryableboolean indicating if retry may succeedsuggestionslist with actionable guidanceformat_user_message()method for user-friendly outputContent Filter Improvements
Better Error Messages
Files Changed
src/midjourney_mcp/errors.py(new) - Error handling modulesrc/midjourney_mcp/api_client.py- Enhanced exception handlingsrc/midjourney_mcp/server.py- Improved error messages in all toolsExample Error Messages
Before
After
Testing
Tested with various error scenarios:
Impact
This improves the user experience by: