Language: Python
Label: vulnerable
CWE: NVD-CWE-noinfo \u2014 

Code:
    def _handle_client_error(self, ex):
        # Called for invalid client input
        # Returns the appropriate error response.
        if not isinstance(ex, ValueError):
            # XXX: Why not self._log_error to send it through the loop's
            # handle_error method?
            traceback.print_exc()
        if isinstance(ex, _InvalidClientRequest):
            # No formatting needed, that's already been handled. In fact, because the
            # formatted message contains user input, it might have a % in it, and attempting
            # to format that with no arguments would be an error.
            self.log_error(ex.formatted_message)
        else:
            self.log_error('Invalid request: %s', str(ex) or ex.__class__.__name__)
        return ('400', _BAD_REQUEST_RESPONSE)