AnsweredAssumed Answered

Catching IntegrityException on webscript

Question asked by spilby on Jun 27, 2014
Latest reply on Jun 27, 2014 by spilby
How can I catch an IntegrityException before my java backed webscript ends?

I use transactions when create the nodes:


       UserTransaction trx = serviceRegistry.getTransactionService().getUserTransaction(false);
      
       try {
         trx.begin();
         //create node
         trx.commit();
      } catch(Throwable e) {
         trx.rollback();
         …
      }   


but the IntegrityException is thrown after the webscript ends. Because of this, I can't catch the exception to return an specific error message.

I don't understand also why this checkIntegrity occurs at the end of the webscript. If I use transactions, why this not occurs when I do the trx.commit()?

I try to add on my desc.xml a <transaction>required</transaction> but the problem continues.

Outcomes