I am not able to get the error in client's Meteor.call
error callback when in the server code, an error occurs inside Meteor.bindEnvironment
. Below is example code to replicate
In the server
Meteor.methods({
customMethod: function(arg1, arg2){
Stripe.customers.create({
email: "email@here.com,
description: "blah blah",
source: token,
metadata: {
planId: planId,
quantity: n
},
plan: planId,
quantity: n
}, Meteor.bindEnvironment(function (err, customer) {
if(err){
console.log("error", err);
// TODO cannot catch this error on the client
throw new Meteor.Error(err.rawType, err.message)
}
}))
}
})
In the client inside a Meteor event,
Meteor.call('customMethod', arg1, arg2, function (err, resp) {
if(err){
Session.set('some-error', err)
}
if(resp){
// TODO cannot catch errors throwing from the server
// when inside Meteor.bindEnvironment
Session.set('some-success', true)
}
});
The session variables are never set. Any help would be great. Thanks!