Bug 623813 - Preserve stack traces when rethrowing exceptions conditionally. r=mconnor

This commit is contained in:
Philipp von Weitershausen 2011-01-13 14:01:05 -08:00
Родитель c8be7f77df
Коммит f25f45ee8f
1 изменённых файлов: 8 добавлений и 20 удалений

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

@ -466,18 +466,13 @@ SyncEngine.prototype = {
try {
try {
item.decrypt();
} catch (ex) {
if (Utils.isHMACMismatch(ex) &&
this.handleHMACMismatch()) {
// Let's try handling it.
// If the callback returns true, try decrypting again, because
// we've got new keys.
this._log.info("Trying decrypt again...");
item.decrypt();
}
else {
throw ex;
}
} catch (ex if (Utils.isHMACMismatch(ex) &&
this.handleHMACMismatch())) {
// Let's try handling it.
// If the callback returns true, try decrypting again, because
// we've got new keys.
this._log.info("Trying decrypt again...");
item.decrypt();
}
if (this._reconcile(item)) {
@ -488,14 +483,7 @@ SyncEngine.prototype = {
count.reconciled++;
this._log.trace("Skipping reconciled incoming item " + item.id);
}
}
catch(ex) {
if (!Utils.isHMACMismatch(ex)) {
// Rethrow anything we shouldn't handle.
throw ex;
}
} catch (ex if (Utils.isHMACMismatch(ex))) {
this._log.warn("Error processing record: " + Utils.exceptionStr(ex));
// Upload a new record to replace the bad one if we have it