Sets the default status of open transactions to LR_FAIL and sends an error message.

ExampleTransaction Functions


lr.failTransWithError( errorMessage ); 


errorMessage The message to output.

The lr.failTransWithError function sets the default exit status to LR_FAIL for all open transactions with LR_AUTO in their lr.endTransaction statement and sends an error message.

The message is sent to the output window.

A transaction's final status is defined in the status parameter of the lr.endTransaction statement. If this status is LR_AUTO, then the value is automatically assigned. By default the value assigned is LR_PASS, which signifies a successful transaction. lr.failTransWithError changes this default value to LR_FAIL.

Return Values

On success, returns the length of the message that was sent. On failure, returns a negative number.


You cannot use standard parameterization for any arguments in this function.


function Action(){
   var status = -1;
   if (status != lr.SUCCESS)
        lr.failTransWithError("An error has occurred");
   lr.endTransaction("t1", lr.AUTO);
   return 0;