AnsweredAssumed Answered

custom action - error handling

Question asked by darionis on Sep 12, 2015
Hello all,

I have a custom action that works fine and it displays error message if RuntimeException is thrown. However, I want to set some property before throwing exception but it is not set: I guess it is because transaction is rolled back when RuntimeExcpetion is thrown.

It goes  like this:


void action() {
  try {
    …
  } catch (Excpetion e) {
    nodeService.setProperty(….);   //this requires new transaction
    throw new RuntimeException();
  }



How can I start new transaction to set a property before rethrowing exception from action's body? I tried with separate private method and classic Spring's 'RequiresNew' annotation but it is ignored. Any other option?

Is there any way to report action error without throwing exception.

Thanks!

Outcomes