Abort

Abort( message )
Abort( message )
Abort( message )
Abort( message )
abort ( message )
abort  message
Abort( message )
Abort( message )

Description

This Abort function terminates the current transaction and augments the returned error with the associated message. Any modifications to data or schema in the aborted transaction will be ignored, even if this modification took place before the abort function was executed.

Parameters

Argument

Type

Definition and Requirements

message

String

An abort message.

Returns

An error is returned with the associated abort message.

Examples

The query below is a single transaction with three statements. The first statement creates a class, the second statement adds an instance to the class, and the third statement aborts the transaction. Due to the transaction being terminated by the Abort call, neither the creation of the class nor the addition of the instance is present in the database.

System.out.println(client.query(
     Arr(
       CreateClass(Obj("name", Value("cars"))),
       Create(
            Class("cars"),
            Obj( "data", Obj( "name", Value("Ford") ) )),
       Abort("Reset Transaction")
     )
).get());
ERROR java.util.concurrent.ExecutionException:
         com.faunadb.client.errors.BadRequestException: transaction aborted: Reset Transaction