Skip to content

Commit

Permalink
GFORMS-1662 - Page NotFound error message in kibana log after new rel…
Browse files Browse the repository at this point in the history
…ease (#1415)
  • Loading branch information
josef-vlach authored Jan 27, 2022
1 parent 6f7bce7 commit ce9b85a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/gform/controllers/ErrResponder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class ErrResponder(
requestHeader: RequestHeader,
message: String,
maybeFormTemplate: Option[FormTemplate],
smartLogger: SmartLogger = smartLocalLogger
smartLogger: SmartLogger
): Future[Result] = {
val l: LangADT = LangADT.fromRequest(requestHeader, langs)
smartLogger.log(s"Bad request: $message")
Expand Down
9 changes: 4 additions & 5 deletions app/uk/gov/hmrc/gform/controllers/ErrorHandler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@ class ErrorHandler(
extends DefaultHttpErrorHandler(environment, configuration, sourceMapper, None) {

private val smartUpstreamLogger = SmartLogger.upstreamLogger
private val smartLocalLogger = SmartLogger.localLogger

override protected def onBadRequest(
requestHeader: RequestHeader,
message: String
): Future[Result] = errResponder.badRequest(requestHeader, message, None)
): Future[Result] = errResponder.badRequest(requestHeader, message, None, smartLocalLogger)

override protected def onNotFound(
requestHeader: RequestHeader,
message: String
): Future[Result] =
errResponder.notFound(requestHeader, message, None, smartUpstreamLogger)
errResponder.notFound(requestHeader, message, None, smartLocalLogger)

override protected def onOtherClientError(
requestHeader: RequestHeader,
Expand All @@ -59,7 +60,6 @@ class ErrorHandler(
maybeFormTemplate.flatMap(maybeFormTemplate =>
errResponder.onOtherClientError(requestHeader, statusCode, message, maybeFormTemplate)
)

}

override def onServerError(requestHeader: RequestHeader, exception: Throwable): Future[Result] = {
Expand All @@ -75,8 +75,7 @@ class ErrorHandler(
case UpstreamErrorResponse.WithStatusCode(statusCode, e) if statusCode == BadRequest.intValue =>
errResponder.badRequest(requestHeader, e.message, maybeFormTemplate, smartUpstreamLogger)
case e: BadRequestException =>
errResponder.badRequest(requestHeader, e.message, maybeFormTemplate)
// case e: UnauthorizedException => TODO redirect to login page
errResponder.badRequest(requestHeader, e.message, maybeFormTemplate, smartLocalLogger)
case UpstreamErrorResponse.WithStatusCode(statusCode, e) if statusCode == Forbidden.intValue =>
errResponder.forbidden(e.message, maybeFormTemplate, None, smartUpstreamLogger)(requestHeader)
case e: ForbiddenException =>
Expand Down

0 comments on commit ce9b85a

Please sign in to comment.