Skip to content

Error Handling

Batyah Rubin edited this page Jan 26, 2023 · 5 revisions

You're currently viewing XMPL V3

Attention: XMPL V5 beta is now available!

By default, all errors are displayed to the user in a full error page. To control the error display on the page, use xmp-failure-js on the form, with XMPLLastHttpError in the javascript function, and xmp-prevent-default-error-handle to the body tag.

<body ng-controller="XMPPersonalizedPage" xmp-prevent-default-error-handle>
...
<form xmp-update xmp-success-js="onSuccess()" xmp-failure-js="onError()">
...
<script>
    function onError(){
        var resposeData = window.XMPLLastHttpError.data;
        var errorCode = resposeData.ErrorCode;
        var displayMessage = resposeData.DisplayMessage;
        alert(displayMessage);
    }
</script>

Additional points:

  • XMPLLastHttpError – Includes the error code and the display message. For more details about XMPL error codes, refer to XMPL Rest API help. You can access the XMPL Rest API help from Circle > Library > Web area.
  • xmp-prevent-default-error-handle – Prevents the default error page from being displayed when an error occurs.
Clone this wiki locally