Playframework: Akka Http Server uses hardcoded DefaultHttpErrorHandler instead of configured error handler

Created on 2 Jul 2018  路  3Comments  路  Source: playframework/playframework

Play Version (2.5.x / etc)

2.6.13

API (Scala / Java / Neither / Both)

Scala

Expected Behavior

The error handler dispatched to should be the class defined by config property play.http.errorHandler

As described in documentation here

Actual Behavior

play.core.server.Server#getHandlerFor always uses DefaultHttpErrorHandler.onServerError through this method logExceptionAndGetResult

This goes against even the doc for the handler which states

Note: this HttpErrorHandler should ONLY be used in DEV or TEST. The way this displays errors to the >user is generally not suitable for a production environment.

And this is basically the issue I wanted to raise, I'm trying to get the custom error handler to execute on our production build so Play html error messages aren't returned. My specific error producing use case is exceptions generated by custom request bindables i.e. using this feature (https://www.playframework.com/documentation/2.6.x/RequestBinders)

good first issue help wanted defect

Most helpful comment

No worries. I think I figured out the problem. See #8506.

All 3 comments

Hi @aselamal,

Thanks for reporting that. I was able to reproduce the problem using a PathBindable that throws an exception.

Do you want to submit a PR to fix the problem?

Best.

Hello,

thanks for your response, At this point in time I'm not familiar enough with the play internals to know how to fix it.

No worries. I think I figured out the problem. See #8506.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Woodz picture Woodz  路  4Comments

Technowise picture Technowise  路  3Comments

sthomp picture sthomp  路  5Comments

ignasi35 picture ignasi35  路  4Comments

gmethvin picture gmethvin  路  3Comments