I have a custom validation function in cloud code, it checks the user is a member certain roles, but following the documentation it suggests, doing this
const validationFunction(){
if(isAdmin){return}else{throw "unauthorised"}
}
Parse.Cloud.define("cloud_test",async(request)=>{
return "hello world"
},validationFunction)
But if the user isn’t admin, the throw “unauthorised” crashes my node app. I assume its because there is no catch block, but returning anything from the validationFunction means the cloud code will run, im a bit baffled as to how you use it? In the example it also shows checking the user against a hard coded userId, thats pretty useless for most circumstances, I use a Role search to check the user has rights, is this wrong?