commit 68c480b7b53234c2211dcbf9534beab4d9c9455b
parent 51e7c8fbefc154cc2ee41ee9ebd1f7224b849436
Author: Simon Kornblith <simon@simonster.com>
Date: Wed, 30 Aug 2006 01:41:51 +0000
- closes #232, University of Michigan library site does not work
- improved handling of scraper errors (hopefully, the hanging should be gone)
Diffstat:
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/xpcom/translate.js b/chrome/chromeFiles/content/scholar/xpcom/translate.js
@@ -1095,9 +1095,7 @@ Scholar.Translate.prototype._itemDone = function(item) {
if(this.type == "web") {
if(!attachment.url && !attachment.document) {
Scholar.debug("not adding attachment: no URL specified");
- }
-
- if(attachment.downloadable && this._downloadAssociatedFiles) {
+ } else if(attachment.downloadable && this._downloadAssociatedFiles) {
if(attachment.document) {
attachmentID = Scholar.Attachments.importFromDocument(attachment.document, myID);
@@ -1223,7 +1221,16 @@ Scholar.Translate.prototype._runHandler = function(type, argument) {
returnValue = this._handlers[type][i](this, argument);
}
} catch(e) {
- Scholar.debug(e+' in handler '+i+' for '+type);
+ if(this._parentTranslator) {
+ // throw handler errors if they occur when a translator is
+ // called from another translator, so that the
+ // "Could Not Translate" dialog will appear if necessary
+ throw(e+' in handler '+i+' for '+type);
+ } else {
+ // otherwise, fail silently, so as not to interfere with
+ // interface cleanup
+ Scholar.debug(e+' in handler '+i+' for '+type);
+ }
}
}
}
diff --git a/scrapers.sql b/scrapers.sql
@@ -1773,7 +1773,7 @@ REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006
if (prefix == ''x'') return namespace; else return null;
} : null;
- var xpath = ''/html/body/table/tbody/tr[td[1][@id="bold"]][td[2]]'';
+ var xpath = ''//table/tbody/tr[td[1][@id="bold"] or td[@class="recordTD"]][td[2]]'';
var elmts = newDoc.evaluate(xpath, newDoc, nsResolver, XPathResult.ANY_TYPE, null);
var elmt;