Add errorHandler option to DataObject.prototype.save()
This allows calling code to do something other than call Zotero.debug() on errors (like, say, nothing, in order to avoid logging certain expected errors) before throwing.
This commit is contained in:
parent
47f3c1efe6
commit
67abbc8c4a
1 changed files with 4 additions and 3 deletions
|
@ -584,9 +584,10 @@ Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options)
|
||||||
Zotero.debug(e2, 1);
|
Zotero.debug(e2, 1);
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
// Don't log expected errors
|
if (options.errorHandler(e)) {
|
||||||
if (e.name != 'ZoteroUnknownFieldError'
|
options.errorHandler(e);
|
||||||
&& e.name != 'ZoteroMissingObjectError') {
|
}
|
||||||
|
else {
|
||||||
Zotero.debug(e, 1);
|
Zotero.debug(e, 1);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue