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

Update the custom error to display the unknown status code label: Unknown status code: "banana" This makes it immediately clear what typo was made.

commit794cf3bbfca6ea27d8a809b191c76b8233f1f9fe authorMark <mark.eibes@gmail.com> dateFri 6 Feb 2026, 22:17 (8 months ago) parent3f4f642
1 file changed+12−6
src/Yoga/HTTP/API/Route/StatusCode.purs+12−6
src/Yoga/HTTP/API/Route/StatusCode.purs+12−6
@@ -11,7 +11,7 @@ import Prelude
1111
1212import Type.Proxy (Proxy(..))
1313import Data.Newtype (class Newtype)
14−import Prim.TypeError (class Fail, Text, Above)
14+import Prim.TypeError (class Fail, Text, Above, Quote, Beside)
1515
1616newtype StatusCode = StatusCode Int
1717
@@ -223,14 +223,20 @@ else instance StatusCodeMapImpl (Proxy "networkAuthenticationRequired") where
223223else instance
224224 ( Fail
225225 ( Above
226− (Text "Unknown status code label. Valid codes:")
226+ (Beside (Text "Unknown status code: ") (Quote sym))
227227 ( Above
228− (Text " • 2xx Success: ok, created, accepted, noContent, etc.")
228+ (Text "")
229229 ( Above
230− (Text " • 3xx Redirect: movedPermanently, found, seeOther, notModified, etc.")
230+ (Text "Valid codes:")
231231 ( Above
232− (Text " • 4xx Client: badRequest, unauthorized, forbidden, notFound, conflict, unprocessableEntity, etc.")
233− (Text " • 5xx Server: internalServerError, badGateway, serviceUnavailable, etc.")
232+ (Text " • 2xx Success: ok, created, accepted, noContent, etc.")
233+ ( Above
234+ (Text " • 3xx Redirect: movedPermanently, found, seeOther, notModified, etc.")
235+ ( Above
236+ (Text " • 4xx Client: badRequest, unauthorized, forbidden, notFound, conflict, unprocessableEntity, etc.")
237+ (Text " • 5xx Server: internalServerError, badGateway, serviceUnavailable, etc.")
238+ )
239+ )
234240 )
235241 )
236242 )