Bug 1024812 - unhandled exceptions in hawkclient no longer cause sync to hang. r=rnewman

This commit is contained in:
Mark Hammond 2014-06-14 11:47:34 +10:00
Родитель 149910a91a
Коммит 79bf688cfb
1 изменённых файлов: 13 добавлений и 1 удалений

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

@ -188,7 +188,7 @@ this.HawkClient.prototype = {
let uri = this.host + path;
let self = this;
function onComplete(error) {
function _onComplete(error) {
let restResponse = this.response;
let status = restResponse.status;
@ -243,6 +243,18 @@ this.HawkClient.prototype = {
deferred.resolve(this.response.body);
};
function onComplete(error) {
try {
// |this| is the RESTRequest object and we need to ensure _onComplete
// gets the same one.
_onComplete.call(this, error);
} catch (ex) {
log.error("Unhandled exception processing response:" +
CommonUtils.exceptionStr(ex));
deferred.reject(ex);
}
}
let extra = {
now: this.now(),
localtimeOffsetMsec: this.localtimeOffsetMsec,