lr_set_custom_error_message

Sets a custom text to be output after built-in error messages.

int lr_set_custom_error_message( const char *format, exp1, exp2,...expn. ); 
Alphabetical Listing - C Language Utility Functions

Arguments

NameComments
format C LanguageA formatted string to send to the Output window. You can specify a literal string in quotation marks or use the standard Message Formatting that is available for printf.
exp1, exp2,.. expnThe expressions or variables to be formatted.

The lr_set_custom_error_message function sets a text to be output after the built-in error messages when an error message is issued.

The message is canceled with lr_remove_custom_error_message.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

Parameterization

All string input arguments can be passed using standard parameterization.

Concept Link IconSee Also

Example

In the following example, lr_set_custom_error_message sets a custom message and lr_remove_custom_error_message cancels it:

Copy code

char * mytext = "customized assertion!";            
lr_set_custom_error_message("Details: [%s], reported at: [%s]",mytext,lr_eval_string("{myParameter}"));            
lr_error_message("error message");            
lr_think_time(3);            
web_url("web_step","URL=http://myserver/notfound","Resource=0",LAST);            
lr_think_time(3);            
web_reg_find("Text=Some text",LAST);                
web_url("to check","URL=http://myserver/index.html",LAST);            
lr_remove_custom_error_message();            
lr_error_message("error message without customization");
Example: Output:
Starting action Action.
Action.c(7): Error: error message
Details: [customized assertion !], reported at: [18]
Action.c(11): web_url("web_step") started  	[MsgId: MMSG-26355]
Action.c(11): Error -26627: HTTP Status-Code=404 (Not Found) for "http://myserver/notfound"  	[MsgId: MERR-26627]
Details: [customized assertion !], reported at: [18]
Action.c(11): web_url("web_step") highest severity level was "ERROR", 1635 body bytes, 160 header bytes  	[MsgId: MMSG-26388]
Ending action Action.