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:
Benjamin Wilson Friedman
2017-10-26 11:28:13 -07:00
committed by Florent Vilmart
parent c2fc0f556e
commit 87b79cedfa
2 changed files with 18 additions and 1 deletions

View File

@@ -1076,6 +1076,19 @@ describe('Cloud Code', () => {
});
});
/**
* Verifies that an afterSave hook throwing an exception
* will not prevent a successful save response from being returned
*/
it('should succeed on afterSave exception', (done) => {
Parse.Cloud.afterSave("AfterSaveTestClass", function () {
throw "Exception";
});
const AfterSaveTestClass = Parse.Object.extend('AfterSaveTestClass');
const obj = new AfterSaveTestClass();
obj.save().then(done, done.fail);
});
describe('cloud jobs', () => {
it('should define a job', (done) => {
expect(() => {