Bug 1003204: Removed CommonUtils.exceptionStr() in toolkit/ r=gfritzsche

This commit is contained in:
Anup Kumar 2015-12-18 04:05:00 +01:00
parent 88e7a10048
commit 6fe93840b3
4 changed files with 15 additions and 29 deletions

View File

@ -14,7 +14,6 @@ Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
Cu.import("resource://gre/modules/Timer.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://services-common/utils.js", this);
Cu.import("resource://gre/modules/TelemetryController.jsm");
Cu.import("resource://gre/modules/KeyValueParser.jsm");
@ -272,8 +271,7 @@ this.CrashManager.prototype = Object.freeze({
}
} catch (ex) {
if (ex instanceof OS.File.Error) {
this._log.warn("I/O error reading " + entry.path + ": " +
CommonUtils.exceptionStr(ex));
this._log.warn("I/O error reading " + entry.path, ex);
} else {
// We should never encounter an exception. This likely represents
// a coding error because all errors should be detected and
@ -282,7 +280,7 @@ this.CrashManager.prototype = Object.freeze({
// If we get here, report the error and delete the source file
// so we don't see it again.
Cu.reportError("Exception when processing crash event file: " +
CommonUtils.exceptionStr(ex));
Log.exceptionStr(ex));
deletePaths.push(entry.path);
}
}
@ -297,8 +295,7 @@ this.CrashManager.prototype = Object.freeze({
try {
yield OS.File.remove(path);
} catch (ex) {
this._log.warn("Error removing event file (" + path + "): " +
CommonUtils.exceptionStr(ex));
this._log.warn("Error removing event file (" + path + ")", ex);
}
}

View File

@ -156,7 +156,7 @@ this.ProfileAge.prototype = {
function onStatFailure(e) {
// Never mind.
self._log.debug("Stat failure: " + CommonUtils.exceptionStr(e));
self._log.debug("Stat failure", e);
}
return OS.File.stat(entry.path)

View File

@ -15,7 +15,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/utils.js");
// We automatically prune sessions older than this.
const MAX_SESSION_AGE_MS = 7 * 24 * 60 * 60 * 1000; // 7 days.
const STARTUP_RETRY_INTERVAL_MS = 5000;
@ -344,8 +343,7 @@ SessionRecorder.prototype = Object.freeze({
this._log.debug("Recording last sessions as #" + count + ".");
this._prefs.set("previous." + count, JSON.stringify(obj));
} catch (ex) {
this._log.warn("Exception when migrating last session: " +
CommonUtils.exceptionStr(ex));
this._log.warn("Exception when migrating last session", ex);
} finally {
this._log.debug("Resetting prefs from last session.");
for (let pref of this._CURRENT_PREFS) {

View File

@ -24,8 +24,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Log",
"resource://gre/modules/Log.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
"resource://services-common/utils.js");
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
@ -580,14 +578,12 @@ ConnectionData.prototype = Object.freeze({
// The best we can do is proceed without a transaction and hope
// things won't break.
if (wrappedConnections.has(this._identifier)) {
this._log.warn("A new transaction could not be started cause the wrapped connection had one in progress: " +
CommonUtils.exceptionStr(ex));
this._log.warn("A new transaction could not be started cause the wrapped connection had one in progress", ex);
// Unmark the in progress transaction, since it's managed by
// some other non-Sqlite.jsm client. See the comment above.
this._hasInProgressTransaction = false;
} else {
this._log.warn("A transaction was already in progress, likely a nested transaction: " +
CommonUtils.exceptionStr(ex));
this._log.warn("A transaction was already in progress, likely a nested transaction", ex);
throw ex;
}
}
@ -599,18 +595,15 @@ ConnectionData.prototype = Object.freeze({
// It's possible that the exception has been caused by trying to
// close the connection in the middle of a transaction.
if (this._closeRequested) {
this._log.warn("Connection closed while performing a transaction: " +
CommonUtils.exceptionStr(ex));
this._log.warn("Connection closed while performing a transaction", ex);
} else {
this._log.warn("Error during transaction. Rolling back: " +
CommonUtils.exceptionStr(ex));
this._log.warn("Error during transaction. Rolling back", ex);
// If we began a transaction, we must rollback it.
if (this._hasInProgressTransaction) {
try {
yield this.execute("ROLLBACK TRANSACTION");
} catch (inner) {
this._log.warn("Could not roll back transaction: " +
CommonUtils.exceptionStr(inner));
this._log.warn("Could not roll back transaction", inner);
}
}
}
@ -629,8 +622,7 @@ ConnectionData.prototype = Object.freeze({
try {
yield this.execute("COMMIT TRANSACTION");
} catch (ex) {
this._log.warn("Error committing transaction: " +
CommonUtils.exceptionStr(ex));
this._log.warn("Error committing transaction", ex);
throw ex;
}
}
@ -776,8 +768,7 @@ ConnectionData.prototype = Object.freeze({
break;
}
self._log.warn("Exception when calling onRow callback: " +
CommonUtils.exceptionStr(e));
self._log.warn("Exception when calling onRow callback", e);
}
}
},
@ -942,7 +933,7 @@ function openConnection(options) {
new OpenedConnection(connection.QueryInterface(Ci.mozIStorageAsyncConnection),
identifier, openedOptions));
} catch (ex) {
log.warn("Could not open database: " + CommonUtils.exceptionStr(ex));
log.warn("Could not open database", ex);
reject(ex);
}
});
@ -1020,7 +1011,7 @@ function cloneStorageConnection(options) {
let conn = connection.QueryInterface(Ci.mozIStorageAsyncConnection);
resolve(new OpenedConnection(conn, identifier, openedOptions));
} catch (ex) {
log.warn("Could not clone database: " + CommonUtils.exceptionStr(ex));
log.warn("Could not clone database", ex);
reject(ex);
}
});
@ -1070,7 +1061,7 @@ function wrapStorageConnection(options) {
wrappedConnections.add(identifier);
resolve(wrapper);
} catch (ex) {
log.warn("Could not wrap database: " + CommonUtils.exceptionStr(ex));
log.warn("Could not wrap database", ex);
throw ex;
}
});