Welcome, Guest

Author Topic: Is there a way to check for JavaScript errors?  (Read 1735 times)

Nick

  • Administrator
  • *****
  • Posts: 475
    • View Profile
Is there a way to check for JavaScript errors?
« on: November 04, 2013, 08:31:21 AM »
For 'engine.trigger' errors you can add the following
Code: [Select]
engine.on('Error', console.log.bind(console, 'binding error:'));
in your JavaScript and errors related to Coherent UI binding will be displayed in the console.

For 'engine.call' errors you can use the error callback of the promise object that engine.call returns:
Code: [Select]
engine.call('MyMethod').then(
    function() {
        // code on success
    }, function() {
        // code on error
    }
);

In general, you set a handler for the engine's “Error” event.
« Last Edit: May 26, 2014, 12:06:51 PM by Nick »
R&D Director @CoherentLabs

Tags: unity