Hello
I have the following method defined on both the client and server
Meteor.methods({
createComment(comment) {
const { graphId, postingId, text, service } = comment;
const _commentId = Comments.insert(comment);
if (Meteor.isServer) {
this.unblock();
const userId = Meteor.userId();
const graph = Graph.findUserGraph({ userId, graphId })
const data = { postingId, graphId: graph.graphId, message: text, tokens: graph.auth }
const comment = Social.reply(service, data);
Comments.upsert({ _id: _commentId }, { $set: comment });
}
}
});
For example, if no text is entered, simple schema throws a Text is required
error, but I am not sure how to capture it. I tryied wrapping the method in a try-catch expression, but for some reason, only the serverside code catches the exception.