From c2dfc1bb34e8153bc7372ce6056c6883616ece9b Mon Sep 17 00:00:00 2001 From: Joseph Date: Wed, 28 Feb 2018 23:33:35 +0000 Subject: Add error messages (#30) * Add error messages Signed-off-by: JoeBanks13 * Remove un-used keyword arg from 404 * Assert for status code instead of full content * PEP8 * test lint * please coverage * oh * Exclude websockets.py from coverage * Move code output into terminal * Switch typewriter href protocol * Add tests for websockets.py * Abort previous commit, coveralls did not let coverage go down * Add more pauses and request => response * move css and js out, add typewriter JS to our own repo & add method for appending text in bulk. * Enable REPL on 4XX and change error descriptions * commas * /error path --- pysite/constants.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'pysite/constants.py') diff --git a/pysite/constants.py b/pysite/constants.py index 59febcc9..f70f48ad 100644 --- a/pysite/constants.py +++ b/pysite/constants.py @@ -20,3 +20,26 @@ OWNER_ROLE = 267627879762755584 ADMIN_ROLE = 267628507062992896 MODERATOR_ROLE = 267629731250176001 HELPER_ROLE = 267630620367257601 + +ERROR_DESCRIPTIONS = { + # 5XX + 500: "The server encountered an unexpected error ._.", + 501: "Woah! You seem to have found something we haven't even implemented yet!", + 502: "This is weird, one of our upstream servers seems to have experienced an error.", + 503: "Looks like one of our services is down for maintenance and couldn't respond to your request.", + 504: "Looks like an upstream server experienced a timeout while we tried to talk to it!", + 505: "You're using an old HTTP version. It might be time to upgrade your browser.", + # 4XX + 400: "You sent us a request that we don't know what to do with.", + 401: "Nope! You'll need to authenticate before we let you do that.", + 403: "No way! You're not allowed to do that.", + 404: "We looked, but we couldn't seem to find that page.", + 405: "That's a real page, but you can't use that method.", + 408: "We waited a really long time, but never got your request.", + 410: "This used to be here, but it's gone now.", + 411: "You forgot to tell us the length of the content.", + 413: "No way! That payload is, like, way too big!", + 415: "The thing you sent has the wrong format.", + 418: "Sorry, I'm not a server, I'm a teapot.", + 429: "Please don't send us that many requests." +} -- cgit v1.2.3