Looking for something that's not here? Let us know: support@tiggzi.com
Documentation‎ > ‎Services‎ > ‎Using on a screen‎ > ‎

Error handling

The best way to handle errors from a service is to use service defined events and invoke actions. A service has three events (select service in Design view, open Events tab):
  • Complete - this event is always called at the end, regardless whether the request was successful or an error occurred. 
  • Error - this event is only called if an error occurred with the request
  • Success - this event is called only if the request was successful. No errors from the service or errors in the data returned. 
Note: both Error and Success events will never be called in the same request. 

Under the hood, these events are invoked via these jQuery functions and their arguments which you may use: 

onComplete': function(jqXHR, textStatus) {}
onSuccess': function(data) {}
onError': function(jqXHR, textStatus, errorThrown) {}

For example, to notify user of an error, the following could be used: 

[Error event/Run Custom JavaScript action]:
alert ('There was a problem with the service.');
// do more here...show error in the screen