-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathErrors.hs
41 lines (29 loc) · 1.74 KB
/
Errors.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module Errors where
import qualified Data.ByteString.Lazy as BL hiding (pack, unpack)
import qualified Data.ByteString.Lazy.Char8 as BL
{-- -- Alternative error messages
inputError = BL.pack "404 Not Found - Please check input and try again"
authenticationError = BL.pack "401 Unauthorized - Authentication Error"
urlError = BL.pack "400 Bad Request - Check URL and try again"
timeLimitError = BL.pack "401 Unauthorized - Request Limit Reached, please wait and try again"
--}
-- Errors.
inputError :: (BL.ByteString, Int, String)
inputError = (BL.pack "Error 8008135", 404, "")
authenticationError :: (BL.ByteString, Int, String)
authenticationError = (BL.pack "Error 69", 401, "")
urlError :: (BL.ByteString, Int, String)
urlError = (BL.pack "Error 666", 400, "")
timeLimitError :: (BL.ByteString, Int, String)
timeLimitError = (BL.pack "Error 420", 401, "")
pageDoesNotExistError :: (BL.ByteString, Int, String)
pageDoesNotExistError = (BL.pack "Error 13", 404, "")
-- This is a full output of an error code, header, and message
error405NotAllowed :: BL.ByteString
error405NotAllowed = BL.pack $ "HTTP/1.0 405 Method Not Allowed\r\nContent-Type: text/plain; charset=\"Shift_JIS\"\r\nContent-Length: 8\r\n\r\nError 42"
error404NotFound :: BL.ByteString
error404NotFound = BL.pack $ "HTTP/1.0 404 Not Found\r\nContent-Type: text/plain; charset=\"Shift_JIS\"\r\nContent-Length: 8\r\n\r\nError 13"
error400BadRequest :: BL.ByteString
error400BadRequest = BL.pack $ "HTTP/1.0 400 Bad Request\r\nContent-Type: text/plain; charset=\"Shift_JIS\"\r\nContent-Length: 8\r\n\r\nError 42"
error501NotImplemented :: BL.ByteString
error501NotImplemented = BL.pack $ "HTTP/1.0 501 Not Implemented\r\nContent-Type: text/plain; charset=\"Shift_JIS\"\r\nContent-Length: 8\r\n\r\nError 42"