Refactored error handling to use custom errors.