[Pkg-mozext-commits] [tabmixplus] 02/147: Refactor ChangeCode.isValidToChange function to show error message in the console with the proper file name and line number
David Prévot
taffit at moszumanska.debian.org
Sat Aug 5 15:27:30 UTC 2017
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 377f8f78dcdc4e9f7d9f28facf1bcec408709404
Author: onemen <tabmix.onemen at gmail.com>
Date: Tue Oct 11 23:03:46 2016 +0300
Refactor ChangeCode.isValidToChange function to show error message in the console with the proper file name and line number
---
chrome/content/changecode.js | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/chrome/content/changecode.js b/chrome/content/changecode.js
index d99f29f..037eba2 100644
--- a/chrome/content/changecode.js
+++ b/chrome/content/changecode.js
@@ -150,27 +150,35 @@ Tabmix.changeCode = function(aParent, afnName, aOptions) {
var notFoundCount = this.notFound.length;
if (this.needUpdate && !notFoundCount)
return true;
- var caller = console.getCallerNameByIndex(2);
+
+ const ex = this.getCallerData(Components.stack);
if (notFoundCount && !this.silent) {
let str = (notFoundCount > 1 ? "s" : "") + "\n ";
- console.clog(caller + " was unable to change " + aName + "." +
- (this.errMsg || "\ncan't find string" + str + this.notFound.join("\n ")) +
- "\n\nTry Tabmix latest development version from tabmixplus.org/tab_mix_plus-dev-build.xpi," +
- "\nReport about this to Tabmix developer at http://tabmixplus.org/forum/");
- if (debugMode)
- console.clog(caller + "\nfunction " + aName + " = " + this.value);
+ ex.message = ex.fnName + " was unable to change " + aName + "." +
+ (this.errMsg || "\ncan't find string" + str + this.notFound.join("\n ")) +
+ "\n\nTry Tabmix latest development version from tabmixplus.org/tab_mix_plus-dev-build.xpi," +
+ "\nReport about this to Tabmix developer at http://tabmixplus.org/forum/";
+ console.reportError(ex);
+ if (debugMode) {
+ console.clog(ex.fnName + "\nfunction " + aName + " = " + this.value, ex);
+ }
} else if (!this.needUpdate && debugMode) {
- console.clog(caller + " no update needed to " + aName);
+ console.clog(ex.fnName + " no update needed to " + aName, ex);
}
return false;
+ },
+
+ getCallerData: function(stack) {
+ let caller = (stack.caller || {}).caller || {};
+ let {filename, lineNumber, columnNumber, name} = caller;
+ return {filename: filename, lineNumber: lineNumber, columnNumber: columnNumber, fnName: name};
}
};
- let name = afnName.split(".").pop();
try {
return new ChangeCode({
obj: aParent,
- fnName: name,
+ fnName: afnName.split(".").pop(),
fullName: afnName,
options: aOptions
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list