From a402350cda13f6da7508b507af568b5cf66bb4a6 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 16 Feb 2012 13:29:32 -0500 Subject: [PATCH] Better error handling in addStatement --- chrome/content/zotero/xpcom/translation/translate.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index d2f050d2b..72c1e2721 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -2155,6 +2155,16 @@ Zotero.Translate.IO._RDFSandbox.prototype = { * (false) */ "addStatement":function(about, relation, value, literal) { + if(about === null || about === undefined) { + throw new Error("about must be defined in Zotero.RDF.addStatement"); + } + if(relation === null || relation === undefined) { + throw new Error("relation must be defined in Zotero.RDF.addStatement"); + } + if(value === null || value === undefined) { + throw new Error("value must be defined in Zotero.RDF.addStatement"); + } + if(literal) { // zap chars that Mozilla will mangle value = value.toString().replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, '');