scala - Wiring a Play Filter to wrap the error handler -
i have play filter post request logging this:
class loggingfilter extends filter 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 have onservererror
handler maps known exceptions appropriate result
. unfortunately, filter invoked before error handler converts known exceptions results, leaving me without status code sent caller , stack trace handled exception in logs.
is there way define filter wraps request post errors handler invocation?