Skip to content

Error Handling

FraudStop provides two callback functions to help with the handling and logging of errors within the script. Using these functions is not required for FraudStop to work, you should only use them if you require the error handling functionality.

Main Callback

This callback function is used to monitor the loading of the script and the progress of token generation.

Warning

Do not use this function in conjunction with an async script tag, i.e. <script src="https://antifraud.empello.net/abcdefgh/ijklmnop-live.js" async></script>

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
  EmpelloInterface.onFraudStopLoaded(function (statusCode) {
    if (statusCode === 101) {
      // main JS loaded
    }
    else if (statusCode === 201) {
      // getToken function is ready
    }
    else if (statusCode === 202) {
      // getToken function is ready but there was an error
    }
    else if (statusCode === 203) {
      // main JS timed out
    }
    else if (statusCode === 204) {
      // JS Info time out
    }
  });

Get Token Callback

This callback function is used to monitor the Empello.getToken function.

1
2
3
4
5
6
7
8
    Empello.getToken({
      success: function (token) {
        alert('success=' + JSON.stringify(token));
      },
      error: function (errors) {
        alert('errors=' + JSON.stringify(errors));
      }
    });