Share this page

# lr.error_message

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

## JavaScript

    function lr.error_message(  message  )

## VBScript

    Function lr.error_message(  message  )

Message Functions

## Arguments

Name | Comments
--- | ---
message | A string containing the error message to send to the Output window.

The lr.error_message function sends an error message to the product'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.output_message.

If Runtime settings > General > Miscellaneous > Fail open transactions on lr.error_message is selected, calling lr.error_message 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.get_transaction_duration before calling lr.error_message, then create a transaction to report the time with lr.set_transaction.

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.log_message 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.error_message 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.

Output of lr.error_message("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

Standard parameterization is not available for this function.

## VBScript Example

In the following example, lr_error_message sends a message to the output window or log file if login fails. "Iteration" "username" and "ssid" are parameters defined with the VuGen UI.

    status = web.url( "www.abc.com", _
    	"URL=https://secure.computing.com//login.asp?user=<username>&session=<ssid>", _
    	    "RecContentType=text/html")

    if (status = lr.FAIL) then
        lr.error_message   _
             lr.eval_string ( "Error at iteration <Iteration>, status = " ) _
             + Cstr(status)

    Example: Output:
    Notify: Parameter Substitution: parameter "username" = "Elinor"
    Notify: Parameter Substitution: parameter "ssid" = "1122"
    Continuing after Error -27798: Could not resolve address of host secure.computing.com     [MsgId: MERR-27798]
    web_url("www.abc.com") highest severity level was "continue on error", 0 body bytes, 0 header bytes     [MsgId: MMSG-26388]
    Continuing after error in Vuser script.
    Notify: Parameter Substitution: parameter "Iteration" = "1"
    Error: Error at iteration 1, status = 1

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