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

This commit is contained in:
Anup Kumar 2015-12-16 09:43:00 +01:00
parent 9cfd553890
commit ab52e589d3
9 changed files with 21 additions and 40 deletions

View File

@ -28,7 +28,6 @@ Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/rest.js");
Cu.import("resource://services-common/utils.js");
/**
* Represents the result of a Bagheera request.
*/
@ -185,8 +184,7 @@ BagheeraClient.prototype = Object.freeze({
let h = Services.telemetry.getHistogramById(options.telemetryCompressed);
h.add(data.length);
} catch (ex) {
this._log.warn("Unable to record telemetry for compressed payload size: " +
CommonUtils.exceptionStr(ex));
this._log.warn("Unable to record telemetry for compressed payload size", ex);
}
}
@ -251,8 +249,7 @@ BagheeraClient.prototype = Object.freeze({
result.request = request;
if (error) {
this._log.info("Transport failure on request: " +
CommonUtils.exceptionStr(error));
this._log.info("Transport failure on request", error);
result.transportSuccess = false;
deferred.resolve(result);
return;

View File

@ -28,7 +28,6 @@ this.EXPORTED_SYMBOLS = ["HawkClient"];
var {interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://services-common/utils.js");
Cu.import("resource://services-crypto/utils.js");
Cu.import("resource://services-common/hawkrequest.js");
Cu.import("resource://services-common/observers.js");
@ -271,8 +270,7 @@ this.HawkClient.prototype = {
// gets the same one.
_onComplete.call(this, error);
} catch (ex) {
log.error("Unhandled exception processing response:" +
CommonUtils.exceptionStr(ex));
log.error("Unhandled exception processing response", ex);
deferred.reject(ex);
}
}

View File

@ -168,7 +168,7 @@ this.Intl.prototype = {
this._accepted = Services.prefs.getComplexValue(
"intl.accept_languages", Ci.nsIPrefLocalizedString).data;
} catch (err) {
this._log.error("Error reading intl.accept_languages pref: " + CommonUtils.exceptionStr(err));
this._log.error("Error reading intl.accept_languages pref", err);
}
},

View File

@ -12,7 +12,6 @@ Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/utils.js");
Cu.import("resource://testing-common/httpd.js");
/**
* This is an implementation of the Bagheera server.
*
@ -159,8 +158,7 @@ BagheeraServer.prototype = {
if (ex instanceof HttpError) {
this._log.info("HttpError thrown: " + ex.code + " " + ex.description);
} else {
this._log.warn("Exception processing request: " +
CommonUtils.exceptionStr(ex));
this._log.warn("Exception processing request", ex);
}
throw ex;

View File

@ -573,8 +573,7 @@ StorageServerCollection.prototype = {
failed[record.id] = "no bso configured";
}
} catch (ex) {
this._log.info("Exception when processing BSO: " +
CommonUtils.exceptionStr(ex));
this._log.info("Exception when processing BSO", ex);
failed[record.id] = "Exception when processing.";
}
}
@ -933,7 +932,7 @@ StorageServer.prototype = {
} catch (ex) {
_("==========================================");
_("Got exception starting Storage HTTP server on port " + this.port);
_("Error: " + CommonUtils.exceptionStr(ex));
_("Error: " + Log.exceptionStr(ex));
_("Is there a process already listening on port " + this.port + "?");
_("==========================================");
do_throw(ex);
@ -1288,7 +1287,7 @@ StorageServer.prototype = {
if (e instanceof HttpError) {
this.respond(req, resp, e.code, e.description, "", {}, timestamp);
} else {
this._log.warn(CommonUtils.exceptionStr(e));
this._log.warn("StorageServer: handleDefault caught an error", e);
throw e;
}
}
@ -1393,8 +1392,7 @@ StorageServer.prototype = {
try {
return handler.call(this, handler, req, resp, version, username, rest);
} catch (ex) {
this._log.warn("Got exception during request: " +
CommonUtils.exceptionStr(ex));
this._log.warn("Got exception during request", ex);
throw ex;
}
}

View File

@ -361,7 +361,7 @@ RESTRequest.prototype = {
channel.asyncOpen(this, null);
} catch (ex) {
// asyncOpen can throw in a bunch of cases -- e.g., a forbidden port.
this._log.warn("Caught an error in asyncOpen: " + CommonUtils.exceptionStr(ex));
this._log.warn("Caught an error in asyncOpen", ex);
CommonUtils.nextTick(onComplete.bind(this, ex));
}
this.status = this.SENT;
@ -517,8 +517,7 @@ RESTRequest.prototype = {
}
} catch (ex) {
this._log.warn("Exception thrown reading " + count + " bytes from " +
"the channel.");
this._log.warn(CommonUtils.exceptionStr(ex));
"the channel", ex);
throw ex;
}
} else {
@ -538,8 +537,7 @@ RESTRequest.prototype = {
this.onProgress();
} catch (ex) {
this._log.warn("Got exception calling onProgress handler, aborting " +
this.method + " " + channel.URI.spec);
this._log.debug("Exception: " + CommonUtils.exceptionStr(ex));
this.method + " " + channel.URI.spec, ex);
this.abort();
if (!this.onComplete) {
@ -606,7 +604,7 @@ RESTRequest.prototype = {
}
}
} catch (ex) {
this._log.error("Error copying headers: " + CommonUtils.exceptionStr(ex));
this._log.error("Error copying headers", ex);
}
this.channel = newChannel;
@ -642,8 +640,7 @@ RESTResponse.prototype = {
try {
status = this.request.channel.responseStatus;
} catch (ex) {
this._log.debug("Caught exception fetching HTTP status code:" +
CommonUtils.exceptionStr(ex));
this._log.debug("Caught exception fetching HTTP status code", ex);
return null;
}
Object.defineProperty(this, "status", {value: status});
@ -658,8 +655,7 @@ RESTResponse.prototype = {
try {
statusText = this.request.channel.responseStatusText;
} catch (ex) {
this._log.debug("Caught exception fetching HTTP status text:" +
CommonUtils.exceptionStr(ex));
this._log.debug("Caught exception fetching HTTP status text", ex);
return null;
}
Object.defineProperty(this, "statusText", {value: statusText});
@ -674,8 +670,7 @@ RESTResponse.prototype = {
try {
success = this.request.channel.requestSucceeded;
} catch (ex) {
this._log.debug("Caught exception fetching HTTP success flag:" +
CommonUtils.exceptionStr(ex));
this._log.debug("Caught exception fetching HTTP success flag", ex);
return null;
}
Object.defineProperty(this, "success", {value: success});
@ -694,8 +689,7 @@ RESTResponse.prototype = {
headers[header.toLowerCase()] = value;
});
} catch (ex) {
this._log.debug("Caught exception processing response headers:" +
CommonUtils.exceptionStr(ex));
this._log.debug("Caught exception processing response headers", ex);
return null;
}

View File

@ -79,7 +79,7 @@ function httpd_setup (handlers, port=-1) {
} catch (ex) {
_("==========================================");
_("Got exception starting HTTP server on port " + port);
_("Error: " + CommonUtils.exceptionStr(ex));
_("Error: " + Log.exceptionStr(ex));
_("Is there a process already listening on port " + port + "?");
_("==========================================");
do_throw(ex);

View File

@ -16,7 +16,6 @@ var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/rest.js");
Cu.import("resource://services-common/utils.js");
Cu.import("resource://services-common/observers.js");
const PREF_LOG_LEVEL = "services.common.log.logger.tokenserverclient";
@ -285,8 +284,7 @@ TokenServerClient.prototype = {
try {
cb(error, result);
} catch (ex) {
self._log.warn("Exception when calling user-supplied callback: " +
CommonUtils.exceptionStr(ex));
self._log.warn("Exception when calling user-supplied callback", ex);
}
cb = null;
@ -295,8 +293,7 @@ TokenServerClient.prototype = {
try {
client._processTokenResponse(this.response, callCallback);
} catch (ex) {
this._log.warn("Error processing token server response: " +
CommonUtils.exceptionStr(ex));
this._log.warn("Error processing token server response", ex);
let error = new TokenServerClientError(ex);
error.response = this.response;

View File

@ -70,7 +70,6 @@ this.CommonUtils = {
},
// Import these from Log.jsm for backward compatibility
exceptionStr: Log.exceptionStr,
stackTrace: Log.stackTrace,
/**
@ -102,7 +101,7 @@ this.CommonUtils = {
return Services.io.newURI(URIString, null, null);
} catch (e) {
let log = Log.repository.getLogger("Common.Utils");
log.debug("Could not create URI: " + CommonUtils.exceptionStr(e));
log.debug("Could not create URI", e);
return null;
}
},