Bug 759642 - Part 1: Add-ons Manager should use Components.Exception consistently when throwing exceptions. r=Unfocused

This commit is contained in:
Fraser Gutteridge 2012-07-30 22:46:45 +12:00
Родитель 98270666df
Коммит 239a139b71
3 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -338,11 +338,15 @@ AddonCompatibilityOverride.prototype = {
*/
function AddonType(aID, aLocaleURI, aLocaleKey, aViewType, aUIPriority, aFlags) {
if (!aID)
throw new Error("An AddonType must have an ID");
throw Components.Exception("An AddonType must have an ID", Cr.NS_ERROR_INVALID_ARG);
if (aViewType && aUIPriority === undefined)
throw new Error("An AddonType with a defined view must have a set UI priority");
throw Components.Exception("An AddonType with a defined view must have a set UI priority",
Cr.NS_ERROR_INVALID_ARG);
if (!aLocaleKey)
throw new Error("An AddonType must have a displayable name");
throw Components.Exception("An AddonType must have a displayable name",
Cr.NS_ERROR_INVALID_ARG);
this.id = aID;
this.uiPriority = aUIPriority;

Просмотреть файл

@ -1587,7 +1587,7 @@ var AddonDatabase = {
ERROR("Failed to open database", e);
if (aSecondAttempt || dbMissing) {
this.databaseOk = false;
throw e;
throw Components.Exception("Failed to open database: " + e, e.result);
}
return tryAgain();
}
@ -1727,7 +1727,8 @@ var AddonDatabase = {
return this.asyncStatementsCache[aKey] = this.connection.createAsyncStatement(sql);
} catch (e) {
ERROR("Error creating statement " + aKey + " (" + sql + ")");
throw e;
throw Components.Exception("Error creating statement " + aKey + " (" + sql + "): " + e,
e.result);
}
},

Просмотреть файл

@ -206,7 +206,8 @@ amManager.prototype = {
_xpcom_factory: {
createInstance: function(aOuter, aIid) {
if (aOuter != null)
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("Component does not support aggregation",
Cr.NS_ERROR_NO_AGGREGATION);
if (!gSingleton)
gSingleton = new amManager();