mirror of
https://github.com/zotero/zotero.git
synced 2026-10-03 02:21:49 +00:00
Show a better error when citeproc-js requests an non-existent item
This commit is contained in:
parent
bb563570f3
commit
f008342dd8
1 changed files with 18 additions and 19 deletions
|
|
@ -471,31 +471,30 @@ Zotero.Cite.System.prototype = {
|
|||
*/
|
||||
"retrieveItem":function retrieveItem(item) {
|
||||
var zoteroItem, slashIndex;
|
||||
if(item instanceof Zotero.Item) {
|
||||
if(typeof item === "object" && item !== null && item instanceof Zotero.Item) {
|
||||
//if(this._cache[item.id]) return this._cache[item.id];
|
||||
zoteroItem = item;
|
||||
} else {
|
||||
var type = typeof item;
|
||||
if(type === "string" && (slashIndex = item.indexOf("/")) !== -1) {
|
||||
// is an embedded item
|
||||
var sessionID = item.substr(0, slashIndex);
|
||||
var session = Zotero.Integration.sessions[sessionID]
|
||||
if(session) {
|
||||
var embeddedCitation = session.embeddedItems[item.substr(slashIndex+1)];
|
||||
if(embeddedCitation) {
|
||||
embeddedCitation.id = item;
|
||||
return embeddedCitation;
|
||||
}
|
||||
} else if(typeof item === "string" && (slashIndex = item.indexOf("/")) !== -1) {
|
||||
// is an embedded item
|
||||
var sessionID = item.substr(0, slashIndex);
|
||||
var session = Zotero.Integration.sessions[sessionID]
|
||||
if(session) {
|
||||
var embeddedCitation = session.embeddedItems[item.substr(slashIndex+1)];
|
||||
if(embeddedCitation) {
|
||||
embeddedCitation.id = item;
|
||||
return embeddedCitation;
|
||||
}
|
||||
} else {
|
||||
// is an item ID
|
||||
//if(this._cache[item]) return this._cache[item];
|
||||
zoteroItem = Zotero.Items.get(item);
|
||||
}
|
||||
} else {
|
||||
// is an item ID
|
||||
//if(this._cache[item]) return this._cache[item];
|
||||
try {
|
||||
zoteroItem = Zotero.Items.get(item);
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
|
||||
if(!zoteroItem) {
|
||||
throw "Zotero.Cite.getCSLItem called to wrap a non-item "+item;
|
||||
throw "Zotero.Cite.System.retrieveItem called on non-item "+item;
|
||||
}
|
||||
|
||||
// don't return URL or accessed information for journal articles if a
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue