Handle possible afterSave exception (#4293)
* capture and log exceptions caused by afterFind * Wording * Consolidated promise chaining * use logger instead of console
This commit is contained in:
committed by
Florent Vilmart
parent
c2fc0f556e
commit
87b79cedfa
@@ -13,6 +13,7 @@ var triggers = require('./triggers');
|
||||
var ClientSDK = require('./ClientSDK');
|
||||
import RestQuery from './RestQuery';
|
||||
import _ from 'lodash';
|
||||
import logger from './logger';
|
||||
|
||||
// query and data are both provided in REST API format. So data
|
||||
// types are encoded by plain old objects.
|
||||
@@ -1121,7 +1122,10 @@ RestWrite.prototype.runAfterTrigger = function() {
|
||||
this.config.liveQueryController.onAfterSave(updatedObject.className, updatedObject, originalObject);
|
||||
|
||||
// Run afterSave trigger
|
||||
return triggers.maybeRunTrigger(triggers.Types.afterSave, this.auth, updatedObject, originalObject, this.config);
|
||||
return triggers.maybeRunTrigger(triggers.Types.afterSave, this.auth, updatedObject, originalObject, this.config)
|
||||
.catch(function(err) {
|
||||
logger.warn('afterSave caught an error', err);
|
||||
})
|
||||
};
|
||||
|
||||
// A helper to figure out what location this operation happens at.
|
||||
|
||||
Reference in New Issue
Block a user