1
edit
Changes
→To output messages to the JS console
There are two ways of outputting messages into the JavaScript console.
One of the ways is using Components.utils.reportError. This is a JavaScript Error object used for returning errors onto the JavaScript console. Developers tend to use this command in the exception handler block of the code. There will be a red stop icon next to the error in the JavaScript console using this method. To print debugging code onto the console, type the following:
Components.utils.reportError("''error message''");
Another alternative in displaying error messages in the JavaScript console is building a custom error messaging function. This guide will call their custom function jsdump. In the function it will contain the following: