better hide exception messages

prometheus2
Thibault Duplessis 2020-03-08 11:13:55 -06:00
parent f7fbafab7c
commit 506ab83dff
3 changed files with 16 additions and 25 deletions

View File

@ -28,7 +28,7 @@ final class ErrorHandler(
lila.mon.http.error(actionName, client, req.method, 500).increment()
lila.log("http").error(s"ERROR 500 $actionName", exception)
if (canShowErrorPage(req))
InternalServerError(views.html.base.errorPage(exception) {
InternalServerError(views.html.site.bits.errorPage {
lila.api.Context.error(
req,
lila.i18n.defaultLang,

View File

@ -1,24 +0,0 @@
package views.html
package base
import lila.api.Context
import lila.app.ui.ScalatagsTemplate._
import controllers.routes
object errorPage {
def apply(ex: Throwable)(implicit ctx: Context) =
layout(
title = "Internal server error"
) {
main(cls := "page-small box box-pad")(
h1("Something went wrong on this page"),
p(
"If the problem persists, please ",
a(href := s"${routes.Main.contact}#help-error-page")("report the bug"),
"."
)
)
}
}

View File

@ -3,6 +3,7 @@ package views.html.site
import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import controllers.routes
object bits {
@ -38,4 +39,18 @@ object bits {
</body>
</html>"""
)
def errorPage(implicit ctx: Context) =
views.html.base.layout(
title = "Internal server error"
) {
main(cls := "page-small box box-pad")(
h1("Something went wrong on this page"),
p(
"If the problem persists, please ",
a(href := s"${routes.Main.contact}#help-error-page")("report the bug"),
"."
)
)
}
}