git.iko.soy/rowtype-yoga/purescript-yoga-http-api
on feat/custom-type-errors help sign in
feat: Show actual symbol in status code error message
794cf3bMark
src/Yoga/HTTP/API/Route/StatusCode.purs+12−6
@@ -11,7 +11,7 @@ import Prelude
11
11
12import Type.Proxy (Proxy(..))
12import Type.Proxy (Proxy(..))
13import Data.Newtype (class Newtype)
13import Data.Newtype (class Newtype)
14−import Prim.TypeError (class Fail, Text, Above)
14+import Prim.TypeError (class Fail, Text, Above, Quote, Beside)
15
15
16newtype StatusCode = StatusCode Int
16newtype StatusCode = StatusCode Int
17
17
@@ -223,14 +223,20 @@ else instance StatusCodeMapImpl (Proxy "networkAuthenticationRequired") where
223else instance
223else instance
224 ( Fail
224 ( Fail
225 ( Above
225 ( Above
226− (Text "Unknown status code label. Valid codes:")
226+ (Beside (Text "Unknown status code: ") (Quote sym))
227 ( Above
227 ( Above
228− (Text " • 2xx Success: ok, created, accepted, noContent, etc.")
228+ (Text "")
229 ( Above
229 ( Above
230− (Text " • 3xx Redirect: movedPermanently, found, seeOther, notModified, etc.")
230+ (Text "Valid codes:")
231 ( Above
231 ( Above
232+ (Text " • 2xx Success: ok, created, accepted, noContent, etc.")
233+ ( Above
234+ (Text " • 3xx Redirect: movedPermanently, found, seeOther, notModified, etc.")
235+ ( Above
232− (Text " • 4xx Client: badRequest, unauthorized, forbidden, notFound, conflict, unprocessableEntity, etc.")
236+ (Text " • 4xx Client: badRequest, unauthorized, forbidden, notFound, conflict, unprocessableEntity, etc.")
233− (Text " • 5xx Server: internalServerError, badGateway, serviceUnavailable, etc.")
237+ (Text " • 5xx Server: internalServerError, badGateway, serviceUnavailable, etc.")
238+ )
239+ )
234 )
240 )
235 )
241 )
236 )
242 )