Skip to content

Commit bfe23a4

Browse files
author
Jayson Ng
committed
Revert "Added Example on how to abort Hooks and functions"
This reverts commit 3350d09.
1 parent 661c5a7 commit bfe23a4

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

_includes/cloudcode/cloud-code.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -217,21 +217,6 @@ Parse.Cloud.beforeSave(Parse.User, async (request) => {
217217
})
218218
```
219219

220-
## Aborting hooks and functions
221-
In order to abort a beforeSave or any hook, you now need to throw an error:
222-
223-
```javascript
224-
// after with async/await
225-
Parse.Cloud.beforeSave('MyClassName', async (request) => {
226-
// valid, will result in a Parse.Error(SCRIPT_FAILED, 'Something went wrong')
227-
throw 'Something went wrong'
228-
// also valid, will fail with Parse.Error(SCRIPT_FAILED, 'Something else went wrong')
229-
throw new Error('Something else went wrong')
230-
// using a Parse.Error is also valid
231-
throw new Parse.Error(1001, 'My error')
232-
});
233-
```
234-
235220
# afterSave Triggers
236221

237222
In some cases, you may want to perform some action, such as a push, after an object has been saved. You can do this by registering a handler with the `afterSave` method. For example, suppose you want to keep track of the number of comments on a blog post. You can do that by writing a function like this:

0 commit comments

Comments
 (0)