Bug 1072244 - Correctly throw the exceptions in TPS framework. r=hskupin DONTBUILD

This commit is contained in:
Cosmin Malutan 2014-10-13 14:25:04 -07:00
parent 27e3de70c4
commit df7e10794e
5 changed files with 9 additions and 9 deletions

View File

@ -82,7 +82,7 @@ TPSCmdLineHandler.prototype = {
var TPSCmdLineFactory = {
createInstance : function(outer, iid) {
if (outer != null) {
throw Components.results.NS_ERROR_NO_AGGREGATION;
throw new Error(Components.results.NS_ERROR_NO_AGGREGATION);
}
return new TPSCmdLineHandler().QueryInterface(iid);
@ -127,10 +127,10 @@ var TPSCmdLineModule = {
}
if (!iid.equals(Components.interfaces.nsIFactory)) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw new Error(Components.results.NS_ERROR_NOT_IMPLEMENTED);
}
throw Components.results.NS_ERROR_NO_INTERFACE;
throw new Error(Components.results.NS_ERROR_NO_INTERFACE);
},
canUnload : function(compMgr) {

View File

@ -74,7 +74,7 @@ var Logger = {
msg += "; " + this._potentialError;
this._potentialError = null;
}
throw("ASSERTION FAILED! " + msg);
throw new Error("ASSERTION FAILED! " + msg);
},
AssertFalse: function(bool, msg, showPotentialError) {
@ -83,7 +83,7 @@ var Logger = {
AssertEqual: function(val1, val2, msg) {
if (val1 != val2)
throw("ASSERTION FAILED! " + msg + "; expected " +
throw new Error("ASSERTION FAILED! " + msg + "; expected " +
JSON.stringify(val2) + ", got " + JSON.stringify(val1));
},

View File

@ -83,7 +83,7 @@ Addon.prototype = {
Logger.AssertTrue(addon.userDisabled, "add-on is enabled: " + addon.id);
return true;
} else if (state) {
throw Error("Don't know how to handle state: " + state);
throw new Error("Don't know how to handle state: " + state);
} else {
// No state, so just checking that it exists.
return true;

View File

@ -776,7 +776,7 @@ Livemark.prototype = {
let [status, livemark] = spinningCb.wait();
if (!Components.isSuccessCode(status)) {
throw status;
throw new Error(status);
}
this.props.item_id = livemark.id;

View File

@ -48,14 +48,14 @@ function goQuitApplication() {
forceQuit = Components.interfaces.nsIAppShellService.eForceQuit;
}
else {
throw 'goQuitApplication: no AppStartup/appShell';
throw new Error('goQuitApplication: no AppStartup/appShell');
}
try {
appService.quit(forceQuit);
}
catch(ex) {
throw('goQuitApplication: ' + ex);
throw new Error('goQuitApplication: ' + ex);
}
return true;