fix: public toggle issue,cloud function error handling

This commit is contained in:
RaktimaNXG
2024-05-30 15:55:16 +05:30
parent dfc6da388c
commit 83fe88911f
5 changed files with 264 additions and 220 deletions
@@ -16,14 +16,17 @@ async function GetPublicTemplate(request) {
templatQuery.equalTo('IsPublic', true);
const getTemplate = await templatQuery.find({ useMasterKey: true });
return getTemplate;
} else {
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Template not found');
}
return { error: "You don't have access of this document!" };
} else {
return { error: 'Please provide username!' };
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Please provide required parameters!');
}
} catch (err) {
console.log('error', err);
return { error: "You don't have access of this document!" };
const code = err.code || 400;
const msg = err.message;
const error = new Parse.Error(code, msg);
throw error;
}
}
export default GetPublicTemplate;