Refactored response error generator