Example: lr_set_custom_error_message and lr_remove_custom_error_message
In the following example, lr_set_custom_error_message sets a custom message and lr_remove_custom_error_message cancels it:
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.