AnsweredAssumed Answered

CommendContext Error handling?

Question asked by jonnyg on Jul 7, 2016
Latest reply on Jul 18, 2016 by trademak
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""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);