Propagate errors in child translators to parents

See http://groups.google.com/group/zotero-dev/browse_thread/thread/59dbd15bf6c84133
This commit is contained in:
Simon Kornblith 2012-01-20 16:16:15 -05:00
parent 79b1fe30dc
commit b617c508b1

View file

@ -288,7 +288,7 @@ Zotero.Translate.Sandbox = {
return translation.getTranslators();
};
var doneHandlerSet = false;
var errorHandlerSet = false, doneHandlerSet = false;
safeTranslator.translate = function() {
translate.incrementAsyncProcesses("safeTranslator#translate()");
setDefaultHandlers(translate, translation);
@ -296,6 +296,10 @@ Zotero.Translate.Sandbox = {
doneHandlerSet = true;
translation.setHandler("done", function() { translate.decrementAsyncProcesses("safeTranslator#translate()") });
}
if(!errorHandlerSet) {
errorHandlerSet = true;
translation.setHandler("error", function(obj, error) { translate.complete(false, error) });
}
return translation.translate(false);
};