Example: lr_fail_trans_with_error

In the following example, the status of transaction t1 is changed to fail because an error has occurred. The specific error string is returned by my_get_error_string and is formatted by lr_fail_trans_with_error as part of the message.

The exit status of transaction t2, which is not LR_AUTO, is unaffected by the call to lr_fail_trans_with_error and it remains LR_PASS.

if (status != SUCCESS)
     lr_fail_trans_with_error("An error has occurred: %s", my_get_error_string(status));

lr_end_transaction("t1", LR_AUTO);
lr_end_transaction("t2", LR_PASS);