signalpoint / jDrupal

A JavaScript Library and API for Drupal Applications
http://jdrupal.tylerfrankenstein.com/
GNU General Public License v2.0
76 stars 38 forks source link

Hook for error handling #7

Closed giorgio79 closed 9 years ago

giorgio79 commented 9 years ago

Hello,

I noticed all errors are output via console.

I would love a hook for errors (I would like to provide a popup for the users etc)

signalpoint commented 9 years ago

@giorgio79 For now, the best way to catch errors is by using the error callback when making any Service calls. For example:

user_load(123, {
  success: function(account) {
    alert(account.name);
  },
  error: function(xhr, status, message) {
    alert(message);
  }
});

Other than that, all errors are internal to jDrupal, and at this point there isn't a hook to do what is requested. Perhaps a Drupal.console.log(); function could be created to output stuff to the console, and it could come with a hook(s) to make that happen.

giorgio79 commented 9 years ago

Beautiful! I thought jdrupal would override that. :)