Reputation: 7070
In Meteor, if the client tries to insert, update, or remove a database document and they aren't allowed to, "insert failed: Access denied" appears in the console. Instead of that silent message, I'd like to run some client-side javascript each time that occurs.
Is there a way I can attach a handler function to the "access denied" event / exception?
Upvotes: 3
Views: 202
Reputation: 64342
The collection functions have callbacks that contain the information you need. Let's use insert as an example:
Posts.insert({message: 'hello'}, function(err, id) {
if (err) {
alert('failed to insert post!');
}
});
Upvotes: 4