Skip to content

Custom Error Message

You can customize the appearance of error messages that display when a server error occurs when making a Live Data request using the liveData.requestHotspot method.

Default Message

If an error occurs while trying to obtain Live Data from your server, the tour will display an error message as the hotspot content. By default, the message looks similar to this:

Custom Message

You can customize the error to change its text and background colors and provide your own error message at the top. Below is an example of a custom error message.

You can also choose to hide the details of the error so that the user does not see them as shown below.

Enabling Custom Messages

To enable custom error message, call the liveData.setCustomError method as shown in the example below.

function onEventPageLoaded(event) {
   let message =
      "<div style='font-size:14px; color:red;font-weight:bold;'>" +
      "Oops, something went wrong!</div><br>" +
      "<div>Please call 800-555-5555.</div>";

   event.api.liveData.setCustomError(message, "black", "#C9DFEC", true);

To hide the error details use false instead of true as the last parameter to setCustomError.