32 lines
851 B
OCaml
32 lines
851 B
OCaml
type error =
|
|
| Moved_permanently of string
|
|
| Found of string
|
|
| See_other of string
|
|
| Bad_request
|
|
| Unauthorized
|
|
| Forbidden
|
|
| Not_found
|
|
| Request_timeout
|
|
| Too_many_requests
|
|
| Internal_server_error
|
|
| Not_implemented
|
|
| Bad_gateway
|
|
| Service_unavailable
|
|
| Gateway_timeout
|
|
|
|
let to_httpcats = function
|
|
| Moved_permanently _url -> `Moved_permanently
|
|
| Found _url -> `Found
|
|
| See_other _url -> `See_other
|
|
| Bad_request -> `Bad_request
|
|
| Unauthorized -> `Unauthorized
|
|
| Forbidden -> `Forbidden
|
|
| Not_found -> `Not_found
|
|
| Request_timeout -> `Request_timeout
|
|
| Too_many_requests -> `Enhance_your_calm
|
|
| Internal_server_error -> `Internal_server_error
|
|
| Not_implemented -> `Not_implemented
|
|
| Bad_gateway -> `Bad_gateway
|
|
| Service_unavailable -> `Service_unavailable
|
|
| Gateway_timeout -> `Gateway_timeout
|