Missing error handling on empty pages (e.g, IEEExplore)

edited May 27, 2020
I was testing automated importing from URLs and when using a bogus IEEE URL (to test my error handling) I noticed that it neither raised an exception nor added any entry to the database. Thus I presume there is some error condition that is not handled somewhere in the IEEExlpore code. The bogus URL was https://ieeexplore.ieee.org/abstract/document/893iwaeufrs8809 and as you can see IEEE is not handling it well either ;)
  • When an import translator is called on an empty text file (which is what happens in the code here), it just fails silently in general.

    I don't think we're particularly concerned about this to be honest, since Zotero has the successful import feedback. This behavior definitely isn't limited to IEEEXplore
  • I don't agree with that reasoning because it is clearly an error case and should be reported back to the caller as such. I possibly don't have the full picture though. In any case, if I understand correctly there is a way to determine if this happens by reverse logic, i.e., by actively checking for success.

    I couldn't immediately determine what you mean by "successful import feedback" though. I would have expected a callback of some sort.
    This is the code I am using currently: https://github.com/stefanct/scholar_to_zotero/blob/2cf50507cfdf0bd3c1d08063c2e5db0f354f5066/import_zotero.js

    I was trying to use the "done" handler by adding the following after setDocument() but that returned success too. Can you please elaborate what you meant?

    translate.setHandler("done", function(obj, success) {
    Zotero.debug("translation done: "+success);
  • You don't need to use callbacks if you're doing this programmatically. translate() returns a promise with the items, so you'll have an empty array when it didn't import anything.
  • I was trying to determine what translate returns previously but couldn't find it in the code :/ Thanks. That works for me.
Sign In or Register to comment.