created helper for errorResponse