Address review comments

This commit is contained in:
Evan Cordell 2016-04-11 16:34:40 -04:00
parent eba75494d9
commit b5db41920f
5 changed files with 16 additions and 16 deletions

View file

@ -316,8 +316,7 @@ def request_error(exception=None, **kwargs):
message = 'Request error.' message = 'Request error.'
if exception: if exception:
message = exception.message message = exception.message
if 'message' in data.keys(): message = data.pop('message', message)
message = data.pop('message')
raise InvalidRequest(message, data) raise InvalidRequest(message, data)

View file

@ -183,16 +183,20 @@ def swagger_route_data(include_internal=False, compact=False):
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'status': { 'status': {
'type': 'integer' 'type': 'integer',
'description': 'Status code of the response.'
}, },
'type': { 'type': {
'type': 'string' 'type': 'string',
'description': 'Reference to the type of the error.'
}, },
'detail': { 'detail': {
'type': 'string' 'type': 'string',
'description': 'Details about the specific instance of the error.'
}, },
'title': { 'title': {
'type': 'string' 'type': 'string',
'description': 'Unique error code to identify the type of error.'
} }
}, },
'required': [ 'required': [

View file

@ -51,6 +51,5 @@ class Error(ApiResource):
""" Get a detailed description of the error """ """ Get a detailed description of the error """
if error_type in ERROR_DESCRIPTION.keys(): if error_type in ERROR_DESCRIPTION.keys():
return error_view(error_type), 200 return error_view(error_type), 200
else: raise NotFound()
raise NotFound()

View file

@ -34,19 +34,19 @@ ERROR_DESCRIPTION = {
class ApiException(Exception): class ApiException(Exception):
""" """
o "type" (string) - A URI reference that identifies the - "type" (string) - A URI reference that identifies the
problem type. problem type.
o "title" (string) - A short, human-readable summary of the problem - "title" (string) - A short, human-readable summary of the problem
type. It SHOULD NOT change from occurrence to occurrence of the type. It SHOULD NOT change from occurrence to occurrence of the
problem, except for purposes of localization problem, except for purposes of localization
o "status" (number) - The HTTP status code - "status" (number) - The HTTP status code
o "detail" (string) - A human-readable explanation specific to this - "detail" (string) - A human-readable explanation specific to this
occurrence of the problem. occurrence of the problem.
o "instance" (string) - A URI reference that identifies the specific - "instance" (string) - A URI reference that identifies the specific
occurrence of the problem. It may or may not yield further occurrence of the problem. It may or may not yield further
information if dereferenced. information if dereferenced.
""" """
@ -58,8 +58,6 @@ class ApiException(Exception):
self.payload = payload self.payload = payload
self.error_type = error_type self.error_type = error_type
print(self)
def to_dict(self): def to_dict(self):
rv = dict(self.payload or ()) rv = dict(self.payload or ())

View file

@ -285,7 +285,7 @@ class TestUserStarredRepositoryList(ApiTestCase):
}, },
expected_code=401) expected_code=401)
def test_star_and_uznstar_repo_user(self): def test_star_and_unstar_repo_user(self):
self.login(READ_ACCESS_USER) self.login(READ_ACCESS_USER)
# Queries: Base + the list query # Queries: Base + the list query