Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/debug.js

Issue 5288886037118976: Adblock Plus Crawler rewrite (Closed)
Patch Set: Addressed comments Created May 7, 2015, 12:04 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« lib/crawler.js ('K') | « lib/crawler.js ('k') | lib/main.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
+}
« lib/crawler.js ('K') | « lib/crawler.js ('k') | lib/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld