# How to handle exception that occur in event handler code?

Exception handling code goes into handleException api defined in EventHandlerCode.scala file.

For example, to log the error that occurs in event handler code:

object LotteryStreamEventHandlerCode extends LotteryStream.Group {
  override def handleException(event: LotteryStreamEvent, context: EventContext, throwable: Throwable): Unit = {
    appLogger.error("Exception in event handler code " + throwable.getMessage + " \n " + throwable.stackTraceString(100))
    //todo: send mail to support
  }
...
}