JsonErrorHandler

uk.gov.hmrc.play.bootstrap.backend.http.JsonErrorHandler
@Singleton
class JsonErrorHandler(auditConnector: AuditConnector, httpAuditEvent: HttpAuditEvent, configuration: Configuration)(implicit ec: ExecutionContext) extends HttpErrorHandler, BackendHeaderCarrierProvider

Attributes

Graph
Supertypes
trait HttpErrorHandler
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def onClientError(request: RequestHeader, statusCode: Int, message: String): Future[Result]

Invoked when a client error occurs, that is, an error in the 4xx series.

Invoked when a client error occurs, that is, an error in the 4xx series.

Value parameters

message

The error message.

request

The request that caused the client error.

statusCode

The error status code. Must be greater or equal to 400, and less than 500.

Attributes

Definition Classes
HttpErrorHandler
override def onServerError(request: RequestHeader, ex: Throwable): Future[Result]

Invoked when a server error occurs.

Invoked when a server error occurs.

Value parameters

exception

The server error.

request

The request that triggered the server error.

Attributes

Definition Classes
HttpErrorHandler

Concrete fields

protected val suppress4xxErrorMessages: Boolean
protected val suppress5xxErrorMessages: Boolean
protected val upstreamWarnStatuses: Seq[Int]

upstreamWarnStatuses is used to determine the log level for exceptions relating to a HttpResponse. You can set this value in your config as a list of integers representing response codes that should log at a warning level rather an error level.

upstreamWarnStatuses is used to determine the log level for exceptions relating to a HttpResponse. You can set this value in your config as a list of integers representing response codes that should log at a warning level rather an error level.

e.g. bootstrap.errorHandler.warnOnly.statusCodes=[400,404,502]

This is used to reduce the number of noise the number of duplicated alerts for a microservice.

Attributes

Implicits

Inherited implicits

implicit protected def hc(implicit request: RequestHeader): HeaderCarrier

Attributes

Inherited from:
BackendHeaderCarrierProvider