Skip to content

Commit

Permalink
Adding the code to error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
dinukadesilva committed Nov 2, 2019
1 parent 42765c9 commit cf49272
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/ElectionApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_by_id(electionId):
if result is None:
raise NotFoundException(
message="Election not found (electionId=%d)" % electionId,
const=MESSAGE_CODE_ELECTION_NOT_FOUND
code=MESSAGE_CODE_ELECTION_NOT_FOUND
)

return Schema().dump(result).data
Expand Down
5 changes: 3 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
cache = Cache(config={
"DEBUG": True, # some Flask specific configs
"CACHE_TYPE": "simple", # Flask-Caching related configs
"CACHE_DEFAULT_TIMEOUT": 18144000000 # One month
"CACHE_DEFAULT_TIMEOUT": 18144000000 # One month
})


Expand All @@ -42,7 +42,8 @@ def render_connexion_problem_exception(connexion_exception):
return json.dumps({
"detail": connexion_exception.detail,
"status": connexion_exception.status,
"title": connexion_exception.title
"title": connexion_exception.title,
"code": connexion_exception.args[4]
}, indent=2), connexion_exception.status


Expand Down

0 comments on commit cf49272

Please sign in to comment.