How to save an entity into failed service task

Hello! I need to log some parameters when exception is created into a service task. For example, exception was thrown in one of the service task. I catch this exception, create own exception, add some parameter to that, save that to camunda db and throw this exception. Accordingly, incident was created by camunda engine. I would like to take back this exception with params in IncidentHandler but I get only entities which were saved before executing the service task, so I can’t log params in exception. How to save an entity to camunda db before service task fail? Maybe I can create custom IncidentContext where I can put any params? Can I get exception entity of failed task from the incident?