Skip to content

Commit

Permalink
more detailed error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
corajr committed Oct 10, 2012
1 parent 073cd62 commit bda0490
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -9,7 +9,7 @@ Paper Machines is an open-source extension for the [Zotero](http://www.zotero.or
In order to run Paper Machines, you will need the following (note that Python and Java are installed automatically on Mac OS X):

* [Zotero](http://www.zotero.org/) with PDF indexing tools installed (see the Search pane of Zotero's Preferences)
* a corpus of documents with high-quality metadata (at least 1,000 for topic modeling purposes)
* a corpus of documents with high-quality metadata (recommended: at least 1,000 for topic modeling purposes)
* Python ([download for Windows](http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi))
* Java ([download for Windows/Mac/Linux/etc.](http://java.com/en/download/index.jsp))

Expand Down
2 changes: 1 addition & 1 deletion chrome/content/papermachines/dialog.xul
Expand Up @@ -6,7 +6,7 @@

<dialog xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&papermachines.dialog.title;" width="400" height="330"
title="&papermachines.dialog.title;" width="400" height="500"
persist="width height screenX screenY"
ondialogaccept="return Zotero_PaperMachines_Dialog.acceptSelection();"
id="zotero-papermachines"
Expand Down
29 changes: 16 additions & 13 deletions chrome/content/papermachines/papermachines.js
Expand Up @@ -210,8 +210,7 @@ Zotero.PaperMachines = {
}

} catch (e){
Zotero.PaperMachines.LOG(e);
throw (e);
Zotero.PaperMachines.ERROR(e);
}
}
},
Expand Down Expand Up @@ -239,8 +238,6 @@ Zotero.PaperMachines = {
var stoplist_lang = Preferences.get("extensions.papermachines.general.lang") || "en";

this.selectStoplist(stoplist_lang);
// var jornal = Zotero.PaperMachines._getLocalFile("/Users/chrisjr/Documents/digaai/PDF JORNAL DOS SPORTS/EDICAO_863/Journal 1.pdf");
// alert(Zotero.PaperMachines.getDateFromPDF(jornal));

this.getStringsFromBundle();

Expand Down Expand Up @@ -479,7 +476,7 @@ Zotero.PaperMachines = {
var thisID = Zotero.PaperMachines.getThisGroupID();
try {
Zotero.PaperMachines.activateMenuItems(thisID);
} catch (e) {Zotero.PaperMachines.LOG(e)}
} catch (e) { Zotero.PaperMachines.ERROR(e); }

if (Zotero.PaperMachines.tagCloudReplace) {
if (!Zotero.PaperMachines.hasBeenExtracted(thisID)) {
Expand All @@ -504,7 +501,7 @@ Zotero.PaperMachines = {
try {
Zotero.PaperMachines.onCollectionSelected();
} catch (e) {
Zotero.PaperMachines.LOG(e.name + ": " + e.message);
Zotero.PaperMachines.ERROR(e);
}
};
win.setTimeout(Zotero.PaperMachines.onCollectionSelected, 500);
Expand Down Expand Up @@ -804,7 +801,6 @@ Zotero.PaperMachines = {
} else {
try {
return ZoteroPane.collectionsView._dataItems.filter(function (d) { return d[0].ref.libraryID == id;})[0][0];
// return Zotero.Groups.getByLibraryID(id);
} catch (e) { return false; }
}
},
Expand Down Expand Up @@ -996,7 +992,7 @@ Zotero.PaperMachines = {
var prog_str = Zotero.File.getContents(progTextFile);
var iterString = prog_str.match(/(?:<)\d+/g);
iterations = parseInt(iterString.slice(-1)[0].substring(1));
} catch (e) { Zotero.PaperMachines.LOG(e.name +": " + e.message);}
} catch (e) { Zotero.PaperMachines.ERROR(e); }


var collectionName = thisGroup.name || thisGroup.getName();
Expand Down Expand Up @@ -1025,8 +1021,7 @@ Zotero.PaperMachines = {
try {
var logTextFile = Zotero.PaperMachines._getLocalFile(processResult["outfile"].replace(".html",".log"));
var log_str = Zotero.File.getContents(logTextFile);
} catch (e) { Zotero.PaperMachines.LOG(e.name +": " + e.message);}

} catch (e) { Zotero.PaperMachines.ERROR(e); }

var collectionName = thisGroup.name || thisGroup.getName();
var logpage_str = '<html><head><meta http-equiv="refresh" content="20;URL=' +
Expand Down Expand Up @@ -1070,15 +1065,19 @@ Zotero.PaperMachines = {

var export_dir = this.filePrompt("export_dir", "getfolder");
if (export_dir) {
var query = "SELECT processor, outfile FROM processed_collections " +
var query = "SELECT processor, process_path, outfile FROM processed_collections " +
"WHERE status = 'done' AND processor != 'extract' AND collection = ?;";
var processes = this.DB.query(query, [thisID]);
var options = [];
for (var i in processes) {
var processResult = processes[i],
process = processResult["processor"],
outfile = processResult["outfile"];
options.push({"name": this.processNames[process], "label": " ", "value": outfile});
outfile = processResult["outfile"],
process_path = processResult["process_path"],
path_parts = process_path.split("/"),
label = ": " + path_parts.slice(2).map(function(d) { return decodeURIComponent(d); }).join(", "),
shortened_label = label.length > 50 ? label.substring(0,50) + "..." : label;
options.push({"name": this.processNames[process] + (path_parts.length > 2 ? shortened_label : ""), "label": " ", "value": outfile});
}
var export_processes = Zotero.PaperMachines.selectFromOptions("export_processes", options, "multiplecheck");
if (export_processes && export_processes.length > 0) {
Expand Down Expand Up @@ -1462,6 +1461,10 @@ Zotero.PaperMachines = {
consoleService.logStringMessage(msg);
Zotero.debug(msg);
},
ERROR: function (e) {
Components.utils.reportError(e);
Zotero.debug(e);
},
getStringsFromBundle: function () {
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
Zotero.PaperMachines.bundle = stringBundleService.createBundle("chrome://papermachines/locale/papermachines.properties");
Expand Down

0 comments on commit bda0490

Please sign in to comment.