示例#1
0
 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
示例#2
0
 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
示例#3
0
    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'))
示例#4
0
    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'))
示例#5
0
    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]'))
示例#6
0
    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'))
示例#7
0
    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]'))
示例#8
0
    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]
示例#9
0
    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]
示例#10
0
    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'))
示例#11
0
        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
示例#12
0
        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