I have a playback filter that does some post recording after this:
class LoggingFilter extends Filter with LazyLogging { override def apply(f: (RequestHeader) => Future[Result])(rh: RequestHeader): Future[Result] = f(rh) andThen { case Success(result) => logger.info(s"[SUCCESS] ${result.header.status}") case Failure(e) => val end = System.currentTimeMillis() val duration = end - start logger.error(s"[FAILURE] ${e.getMessage}}", e) } } }
I also have an onServerError handler that maps some known exceptions to the corresponding Result . Unfortunately, the filter is called before the error handler converts the known exceptions to results, leaving me without the STATUS code that I sent to the caller and stack traces for the processed exception in the logs.
Is there a way to define a filter so that it wraps the call of the post post error handler?
source share