Skip to content

Commit 17649c9

Browse files
author
Nat Williams
committed
more specific exception for missing Request classes
1 parent 2ca15bb commit 17649c9

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

pygithub3/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class InvalidBodySchema(Exception):
88
pass
99

1010

11-
class DoesNotExists(Exception):
11+
class RequestDoesNotExist(Exception):
1212
""" Raised when `Request` factory can't find the subclass """
1313
pass
1414

pygithub3/requests/base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
except ImportError:
88
import json
99

10-
from pygithub3.exceptions import (DoesNotExists, UriInvalid, ValidationError,
11-
InvalidBodySchema)
10+
from pygithub3.exceptions import (RequestDoesNotExist, UriInvalid,
11+
ValidationError, InvalidBodySchema)
1212
from pygithub3.resources.base import Raw
1313
from pygithub3.core.utils import import_module
1414

@@ -126,11 +126,11 @@ def wrapper(self, request_uri, **kwargs):
126126
% (ABS_IMPORT_PREFIX, module_chunk))
127127
request = getattr(module, request_chunk)
128128
except ImportError:
129-
raise DoesNotExists("'%s' module does not exists"
130-
% module_chunk)
129+
raise RequestDoesNotExist("'%s' module does not exist"
130+
% module_chunk)
131131
except AttributeError:
132-
raise DoesNotExists(
133-
"'%s' request doesn't exists into '%s' module"
132+
raise RequestDoesNotExist(
133+
"'%s' request does not exist in '%s' module"
134134
% (request_chunk, module_chunk))
135135
return func(self, request, **kwargs)
136136
return wrapper

pygithub3/tests/requests/test_core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
from pygithub3.tests.utils.core import TestCase
88
from pygithub3.requests.base import Factory, Body, json, Request
9-
from pygithub3.exceptions import (UriInvalid, DoesNotExists, ValidationError,
10-
InvalidBodySchema)
9+
from pygithub3.exceptions import (UriInvalid, RequestDoesNotExist,
10+
ValidationError, InvalidBodySchema)
1111
from pygithub3.tests.utils.base import (mock_json, DummyRequest,
1212
DummyRequestValidation)
1313
from pygithub3.tests.utils.requests import (
@@ -29,8 +29,8 @@ def test_BUILDER_with_invalid_action(self):
2929
self.assertRaises(UriInvalid, self.f, '.invalid')
3030

3131
def test_BUILDER_with_fake_action(self):
32-
self.assertRaises(DoesNotExists, self.f, 'users.fake')
33-
self.assertRaises(DoesNotExists, self.f, 'fake.users')
32+
self.assertRaises(RequestDoesNotExist, self.f, 'users.fake')
33+
self.assertRaises(RequestDoesNotExist, self.f, 'fake.users')
3434

3535
def test_BUILDER_builds_users(self):
3636
""" Users.get as real test because it wouldn't be useful mock

0 commit comments

Comments
 (0)