commit a402350cda13f6da7508b507af568b5cf66bb4a6 parent 95fa3bc5547a44cea5ec90e49f102191f1d2ac7e Author: Simon Kornblith <simon@simonster.com> Date: Thu, 16 Feb 2012 13:29:32 -0500 Better error handling in addStatement Diffstat:
| M | chrome/content/zotero/xpcom/translation/translate.js | | | 10 | ++++++++++ |
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git 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, '');