1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-15 20:23:31 +01:00

Ammend revision 9f791638b3ef: Don't throw, but report error.

This commit is contained in:
Kris Maglione
2011-02-27 05:48:34 -05:00
parent 02b43a6986
commit 191ece33e0
2 changed files with 5 additions and 4 deletions

View File

@@ -346,7 +346,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
dactyl.reportError(str); dactyl.reportError(str);
if (isObject(str) && "echoerr" in str) if (isObject(str) && "echoerr" in str)
str = str.echoerr; str = str.echoerr;
else if (isinstance(str, ["Error"]) && str.fileName) else if (isinstance(str, ["Error", FailedAssertion]) && str.fileName)
str = <>{str.fileName.replace(/^.* -> /, "")}: {str.lineNumber}: {str}</>; str = <>{str.fileName.replace(/^.* -> /, "")}: {str.lineNumber}: {str}</>;
if (options["errorbells"]) if (options["errorbells"])
@@ -1405,7 +1405,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
* @param {Object} error The error object. * @param {Object} error The error object.
*/ */
reportError: function reportError(error, echo) { reportError: function reportError(error, echo) {
if (error instanceof FailedAssertion || error.message === "Interrupted") { if (error instanceof FailedAssertion && error.noTrace || error.message === "Interrupted") {
let context = contexts.context; let context = contexts.context;
let prefix = context ? context.file + ":" + context.line + ": " : ""; let prefix = context ? context.file + ":" + context.line + ": " : "";
if (error.message && error.message.indexOf(prefix) !== 0) if (error.message && error.message.indexOf(prefix) !== 0)
@@ -1424,7 +1424,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
return; return;
if (echo) if (echo)
dactyl.echoerr(error, commandline.FORCE_SINGLELINE); dactyl.echoerr(error, commandline.FORCE_SINGLELINE);
util.reportError(error); else
util.reportError(error);
}, },
/** /**

View File

@@ -215,7 +215,7 @@ var Contexts = Module("contexts", {
enumerable: true, enumerable: true,
get: function () self, get: function () self,
set: function (val) { set: function (val) {
throw TypeError("Not replacing plugin context for " + self.NAME); util.dactyl(val).reportError(FailedAssertion("Not replacing plugin context for " + self.NAME, 3, false), true);
} }
}); });
} }