def _to_url(cls, url_path): try: return u'{0}{1}'.format(cls.BASE_URL, url_path) except Exception as e: write_error_message(url_path) write_exception(e) raise e
def test_exception_message(self): try: raise InvalidRequestError('Look for me in validation') except Exception as e: write_exception(e) output = self._stringio.getvalue() T.assert_equal(0, output.find('[ERROR] InvalidRequestError Look for me in validation'))
def test_specific_exception(self): try: raise InvalidRequestError() except Exception as e: write_exception(e) output = self._stringio.getvalue() T.assert_equal(0, output.find('[ERROR] InvalidRequestError'))
def test_simple_exception(self): try: raise Exception() except Exception as e: write_exception(e) output = self._stringio.getvalue() T.assert_equal(0, output.find('[ERROR]'))
def _to_urls(cls, fmt_url_path, url_path_args): url_paths = [] for path_arg in url_path_args: try: url_paths.append(fmt_url_path.format(path_arg)) except Exception as e: write_error_message(path_arg) write_exception(e) raise e return [cls._to_url(url_path) for url_path in url_paths]
def test_exception_message(self): try: raise InvalidRequestError('Look for me in validation') except Exception as e: write_exception(e) output = self._stringio.getvalue() T.assert_equal( 0, output.find( '[ERROR] InvalidRequestError Look for me in validation'))
def wrapper(*args, **kwargs): try: result = fn(*args, **kwargs) return result except InvalidRequestError as e: write_exception(e) if hasattr(e, 'request'): write_error_message('request {0}'.format(repr(e.request))) if hasattr(e, 'response'): write_error_message('response {0}'.format(repr(e.response))) raise e