Address review comments
This commit is contained in:
parent
eba75494d9
commit
b5db41920f
5 changed files with 16 additions and 16 deletions
|
@ -316,8 +316,7 @@ def request_error(exception=None, **kwargs):
|
|||
message = 'Request error.'
|
||||
if exception:
|
||||
message = exception.message
|
||||
if 'message' in data.keys():
|
||||
message = data.pop('message')
|
||||
message = data.pop('message', message)
|
||||
raise InvalidRequest(message, data)
|
||||
|
||||
|
||||
|
|
|
@ -183,16 +183,20 @@ def swagger_route_data(include_internal=False, compact=False):
|
|||
'type': 'object',
|
||||
'properties': {
|
||||
'status': {
|
||||
'type': 'integer'
|
||||
'type': 'integer',
|
||||
'description': 'Status code of the response.'
|
||||
},
|
||||
'type': {
|
||||
'type': 'string'
|
||||
'type': 'string',
|
||||
'description': 'Reference to the type of the error.'
|
||||
},
|
||||
'detail': {
|
||||
'type': 'string'
|
||||
'type': 'string',
|
||||
'description': 'Details about the specific instance of the error.'
|
||||
},
|
||||
'title': {
|
||||
'type': 'string'
|
||||
'type': 'string',
|
||||
'description': 'Unique error code to identify the type of error.'
|
||||
}
|
||||
},
|
||||
'required': [
|
||||
|
|
|
@ -51,6 +51,5 @@ class Error(ApiResource):
|
|||
""" Get a detailed description of the error """
|
||||
if error_type in ERROR_DESCRIPTION.keys():
|
||||
return error_view(error_type), 200
|
||||
else:
|
||||
raise NotFound()
|
||||
raise NotFound()
|
||||
|
||||
|
|
|
@ -34,19 +34,19 @@ ERROR_DESCRIPTION = {
|
|||
|
||||
class ApiException(Exception):
|
||||
"""
|
||||
o "type" (string) - A URI reference that identifies the
|
||||
- "type" (string) - A URI reference that identifies the
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
information if dereferenced.
|
||||
"""
|
||||
|
@ -58,8 +58,6 @@ class ApiException(Exception):
|
|||
self.payload = payload
|
||||
self.error_type = error_type
|
||||
|
||||
print(self)
|
||||
|
||||
def to_dict(self):
|
||||
rv = dict(self.payload or ())
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ class TestUserStarredRepositoryList(ApiTestCase):
|
|||
},
|
||||
expected_code=401)
|
||||
|
||||
def test_star_and_uznstar_repo_user(self):
|
||||
def test_star_and_unstar_repo_user(self):
|
||||
self.login(READ_ACCESS_USER)
|
||||
|
||||
# Queries: Base + the list query
|
||||
|
|
Reference in a new issue