How to catch any err msg in Meteor?


#1

In the official docs, I see this:

    Meteor.call("methodName", function (error) {
      // identify the error
      if (error.error === "logged-out") {
        // show a nice error message
        Session.set("errorMessage", "Please log in to post a comment.");
      }
    });

I want to catch an exception in a method regardless of what the err msg is. Is this the way to do that:

    Meteor.call('insertJobLocationData', companyid, jobloc, function (err) {
    if (err) {
      Session.set("lastErrMsg", "insertJobLocationData failed");
    }

?


#2

use FlashMessages,

https://atmospherejs.com/mrt/flash-messages