Skip to content

Commit

Permalink
Issue webcompat#929 - Error Dictionary and generic error handlers for…
Browse files Browse the repository at this point in the history
… error codes 400,401,403,404,500
  • Loading branch information
deepthivenkat committed Mar 10, 2016
1 parent ea0deca commit 8620cb1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions webcompat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
from webcompat.api.uploads import upload


ERROR_DICT = { 400: 'Bad Request.',
401: 'Unauthorized. Please log in.',
403: 'Forbidden. Maybe that looking at private stuff?',
404: 'Not Found. Lost in Punk Cat Space',
429: 'Cool your jets! Please wait {0} seconds before making'
' another search.',
500: 'Internal Server Error',
GitHubError: "'Something bad happened. Please try again?', 'error'"}
ERROR_DICT = {400: 'Bad Request.',
401: 'Unauthorized. Please log in.',
403: 'Forbidden. Maybe that looking at private stuff?',
404: 'Not Found. Lost in Punk Cat Space',
429: 'Cool your jets! Please wait {0} seconds before making'
'another search.',
500: 'Internal Server Error',
GitHubError: 'Something bad happened. Please try again?'}


@app.teardown_appcontext
Expand Down Expand Up @@ -354,5 +354,5 @@ def too_many_requests_status(err):
time_left = 60
message = (ERROR_DICT[err.code]).format(time_left)
error_data = {'message': message, 'timeout': 5}
return (json.dumps(error_data), err.code, {'content-type': 'application/json'})

return (json.dumps(error_data),
err.code, {'content-type': 'application/json'})

0 comments on commit 8620cb1

Please sign in to comment.