AnsweredAssumed Answered

Transaction isn't rolled back

Question asked by ajeje93 on Mar 30, 2018
Latest reply on Mar 30, 2018 by ajeje93

Hello everyone,

 

I have this script that copies a file in Company Home and throws and exception after the copy throws and exception.

function main(){

   try{
      var node = utils.getNodeFromString("workspace://SpacesStore/c9a77e78-2034-46ec-ae36-48049ee088d7");

      var nn = node.copy(companyhome);
      throw "exception";
   }catch(e){
      print(e.stack);
      status.setCode(status.STATUS_NOT_FOUND, e);
      return null;
   }
}
main();

I set the level of transaction to required, but the file is copied anyways.

I have three questions:

  • Why is there not a rollback?
  • What am I doing wrong?
  • How can I tell Alfresco not to copy the file if there is an exception?

 

Ludovico

Outcomes