diff options
author | 2012-04-17 14:42:57 -0500 | |
---|---|---|
committer | 2012-04-17 14:42:57 -0500 | |
commit | 17649c939901573af53beeeeb9d7be08102d1503 (patch) | |
tree | fc3a99aafc36d61b7381043aede9807a66813886 /pygithub3 | |
parent | let request objects specify custom body validations (diff) | |
download | python-github3-17649c939901573af53beeeeb9d7be08102d1503.tar.xz python-github3-17649c939901573af53beeeeb9d7be08102d1503.zip |
more specific exception for missing Request classes
Diffstat (limited to 'pygithub3')
-rw-r--r-- | pygithub3/exceptions.py | 2 | ||||
-rw-r--r-- | pygithub3/requests/base.py | 12 | ||||
-rw-r--r-- | pygithub3/tests/requests/test_core.py | 8 |
3 files changed, 11 insertions, 11 deletions
diff --git a/pygithub3/exceptions.py b/pygithub3/exceptions.py index a467256..20cf058 100644 --- a/pygithub3/exceptions.py +++ b/pygithub3/exceptions.py @@ -8,7 +8,7 @@ class InvalidBodySchema(Exception): pass -class DoesNotExists(Exception): +class RequestDoesNotExist(Exception): """ Raised when `Request` factory can't find the subclass """ pass diff --git a/pygithub3/requests/base.py b/pygithub3/requests/base.py index 582a73f..d3e18a3 100644 --- a/pygithub3/requests/base.py +++ b/pygithub3/requests/base.py @@ -7,8 +7,8 @@ try: except ImportError: import json -from pygithub3.exceptions import (DoesNotExists, UriInvalid, ValidationError, - InvalidBodySchema) +from pygithub3.exceptions import (RequestDoesNotExist, UriInvalid, + ValidationError, InvalidBodySchema) from pygithub3.resources.base import Raw from pygithub3.core.utils import import_module @@ -126,11 +126,11 @@ class Factory(object): % (ABS_IMPORT_PREFIX, module_chunk)) request = getattr(module, request_chunk) except ImportError: - raise DoesNotExists("'%s' module does not exists" - % module_chunk) + raise RequestDoesNotExist("'%s' module does not exist" + % module_chunk) except AttributeError: - raise DoesNotExists( - "'%s' request doesn't exists into '%s' module" + raise RequestDoesNotExist( + "'%s' request does not exist in '%s' module" % (request_chunk, module_chunk)) return func(self, request, **kwargs) return wrapper diff --git a/pygithub3/tests/requests/test_core.py b/pygithub3/tests/requests/test_core.py index 9fcec10..4632056 100644 --- a/pygithub3/tests/requests/test_core.py +++ b/pygithub3/tests/requests/test_core.py @@ -6,8 +6,8 @@ from nose.tools import raises from pygithub3.tests.utils.core import TestCase from pygithub3.requests.base import Factory, Body, json, Request -from pygithub3.exceptions import (UriInvalid, DoesNotExists, ValidationError, - InvalidBodySchema) +from pygithub3.exceptions import (UriInvalid, RequestDoesNotExist, + ValidationError, InvalidBodySchema) from pygithub3.tests.utils.base import (mock_json, DummyRequest, DummyRequestValidation) from pygithub3.tests.utils.requests import ( @@ -29,8 +29,8 @@ class TestFactory(TestCase): self.assertRaises(UriInvalid, self.f, '.invalid') def test_BUILDER_with_fake_action(self): - self.assertRaises(DoesNotExists, self.f, 'users.fake') - self.assertRaises(DoesNotExists, self.f, 'fake.users') + self.assertRaises(RequestDoesNotExist, self.f, 'users.fake') + self.assertRaises(RequestDoesNotExist, self.f, 'fake.users') def test_BUILDER_builds_users(self): """ Users.get as real test because it wouldn't be useful mock |