Extracts duplicated error response creation