Refactored domain error handling