[SOLVED] Meteor.Error throw issues?

Hard to post with the forum CSS being all messed up, but right now, fo rno apparent reason I can not get throw new Meteor.Error(etc, etc) to throw from the server in a methods method and populate into the callback in Safari and Firefox. It does however appear to work almost everytime for Chrome. I can get some code samples when the form seems to be up again.

server/signup.js

Meteor.methods({


 createCustomer: function(email, card) {
    console.log('server');
    if (!email || !card) {
      throw new Meteor.Error('missing fields');
    }
    return {
      id: 1,
      email: email,
      card: card
    };
  },
  createCustomerSubscription: function(custId, plan) {
    return {
      plan: {
        customerId: custId,
        name: plan
      }
    };
  }
});

client/signup.js

Meteor.call('createCustomer', customer, function(error, response) {
  if (error) {
    return console.log(error);
  } else {
    return console.log(response);
  }
});

I am seeing the console log for the that says server, in the terminal, but do not see any browser console logs in Safari or Firefox, yet I do in Chrome.

I’m thinking you need to change return console.log(...) into console.log(...) - i.e. delete return.

Was just a leftover from coffeescript converting, however, removing the return from the console.log line provided no change. It seems as though throwing the error in the server is just not returning into the callback on the client, at all.(in FF and Safari)

Interesting. I’ve just tried pasting a console.log('x') into chrome, firefox, opera and IE (no safari). It works on all except firefox.

MSDN says “This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.”

So, maybe it’s firefox? It doesn’t mean the error’s not being caught - just that you may not be able to console.log it.

Well, I wasn’t using it for production purposes, the code above was the minimal code to show the issue I am experiencing. I am not able to have anything inside the callback work, no alerts, no method that throws a flash message to the screen…nothing. Seems like somewhere between the throw being initiated on the server to and the callback in the client Meteor.call.

This is specific to an application I have now…a new repo doesn’t seem to exhibit this issue. Not sure where I can look to see what may be intercepting the throw. :confused:

A SubsManager sub in a waitOn was causing the issue. Stopped the configure’d global waitOn for the route with the issue and the errors were being thrown back to the server. Only figured it our by eliminating lines of code in files, file by file…