cancel
Showing results for 
Search instead for 
Did you mean: 

CommendContext Error handling?

jonnyg
Confirmed Champ
Confirmed Champ
I understand from BpmnError catching that JavaDelegates should throw a BpmnError when catching an exception.

But what if it's an uncaught exception (NullPointer, ClassCast, etc). Accidents can happen, after all.

Presently CommandContext logs this as a DEBUG level… That's not ideal. Optimistic locking exceptions should be at INFO, and all other exceptions should be at ERROR.


if (exception != null) {
  if (exception instanceof JobNotFoundException || exception instanceof ActivitiTaskAlreadyClaimedException) {
    // reduce log level, because this may have been caused because of job deletion due to cancelActiviti="true"
    log.info("Error while closing command context", exception);
  } else if (exception instanceof ActivitiOptimisticLockingException) {
    // reduce log level, as normally we're not interested in logging this exception
    log.debug("Optimistic locking exception : " + exception);
  } else {
    log.debug("Error while closing command context", exception);
  }

1 REPLY 1

trademak
Star Contributor
Star Contributor
Hi,

I think your point about the log level for the other exceptions is correct. We've changed it just now.
For Optimistic locking exceptions the log level is set to debug on purpose. The Engine will handle optimstic locking exceptions and the log message is mainly useful in debugging cases.

Best regards,