Home > Back-end >  If my datastore transaction fails, will code after the transaction run?
If my datastore transaction fails, will code after the transaction run?

Time:05-27

What happens if my datastore transaction fails and I have some more code that is supposed to run after it finishes? Does the application throw and error and end there? Will my second block of code run or will it never be reached?

ofy().transact(new Runnable() {
    @Override
    public void run() {
        // Some code here.
    }
});

// Some more datastore code here. Will this be reached if the transact fails?

CodePudding user response:

If the transaction fails you will get an exception. If you don't handle the exception it will propagate.

  • Related