You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's a common pattern for Ring handlers to return nil. However, when this is the case, coercion-middleware explodes with non-informative message:
java.lang.NullPointerException
at fnhouse.middleware$response_walker$fn__5341.invoke(middleware.clj:90)
at fnhouse.middleware$eval5351$coercion_middleware__5352$fn__5356$fn__5358.invoke(middleware.clj:113)
at fnhouse.routes$eval4736$root_handler__4737$fn__4738$fnk4739__4745$fn__4746.invoke(routes.clj:131)
at fnhouse.routes$eval4736$root_handler__4737$fn__4738$fnk4739__4745.invoke(routes.clj:128)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
at clojure.lang.RestFn.invoke(RestFn.java:408)
...
It happens when anonymous function in response-walker gets nil for response. I don't know what would be better: to give more informative message there or to skip output coercion, assuming that there is an or somewhere upstream and other handler will be called or 404 will be raised.
Which approach is better and should I make a PR with fix?
The text was updated successfully, but these errors were encountered:
For now, fnhouse is structured so that the handler must always be uniquely determined by the route, so I'm not sure passing the nil through is the right thing (but very open to discussing options). The simplest option for now seems to be to make the error message better, for which a PR would definitely be welcome.
It's a common pattern for Ring handlers to return
nil
. However, when this is the case,coercion-middleware
explodes with non-informative message:It happens when anonymous function in
response-walker
getsnil
forresponse
. I don't know what would be better: to give more informative message there or to skip output coercion, assuming that there is anor
somewhere upstream and other handler will be called or 404 will be raised.Which approach is better and should I make a PR with fix?
The text was updated successfully, but these errors were encountered: