Share this page

# lr.errorMessage

Sends an error message with location details to the output windows, log files, and other test report summaries.

Example | Message Functions

## Syntax

    lr.errorMessage( message );

## Arguments

Argument | Comments
--- | ---
message | The error message to send.

The lr.errorMessage function sends an error message to the application's output windows, log files, and other test report summaries.

The message size is limited to 5 KB.

To send a special notification that is not specifically an error message, use lr.outputMessage.

If Runtime settings > General > Miscellaneous > fail open transactions on lr.errorMessage is selected, calling lr.errorMessage will fail the transaction in addition to sending the message. If you want to save the elapsed time in spite of the transaction failure, capture the time with lr.getTransactionDuration before calling lr.errorMessage, then create a transaction to report the time with lr.setTransaction.

It is not recommended that you send a message to the Output window in the middle of a transaction, as it will lengthen the execution time. Instead, use lr.logMessage to send the message only to the Vuser log file. This conserves the resources required for sending messages to the output window.

VuGen displays the message text of the lr.errorMessage function in the Execution log in red, using Error code 17999. Note that this function sends a message to the output even when logging is disabled in the runtime settings.

In the Vuser Execution log, this function lists the location and line number from where the message was issued. To issue a message without those details, use lr.message.

lr.setDebugMessage calls can affect the output from lr.errorMessage.

Output of lr.errorMessage("output message"); - action(4):output message

Output of lr.message("message"); - message

## Return Values

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

## Parameterization

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

See Also

## Example

    function Action(){
       var status = web.url({name : 'Login',
                    url:'https://secure.computing.com//login.asp?user={username}&session={ssid}',
                    recContentType:'text/html'});
       if (status == lr.FAIL) {
            lr.errorMessage("Error: Unable to login to secure computing");
            return -1;
       }

    return 0;
    }

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: