| Index: lib/debug.js |
| =================================================================== |
| new file mode 100644 |
| --- /dev/null |
| +++ b/lib/debug.js |
| @@ -0,0 +1,24 @@ |
| +/* |
| + * This Source Code is subject to the terms of the Mozilla Public License |
| + * version 2.0 (the "License"). You can obtain a copy of the License at |
| + * http://mozilla.org/MPL/2.0/. |
| + */ |
| + |
| +/** |
| + * @module debug |
| + */ |
| + |
| +/** |
| + * Reports an exception both to Browser Console and stdout. |
| + * |
| + * @param {Exception|Error} e |
| + */ |
| +exports.reportException = function(e) |
| +{ |
| + let stack = ""; |
| + if (e && typeof e == "object" && "stack" in e) |
| + stack = e.stack + "\n"; |
| + |
| + Cu.reportError(e); |
| + dump(e + "\n" + stack + "\n"); |
|
Sebastian Noack
2015/05/07 00:46:45
Note that the trailing newline will be duplicated.
|
| +} |