Throw Meteor.Error inside a module

Hi, need help with one interesting thing:
i have ES6 class which i import to meteor code, inside this class i used throw new Meteor.Error() to throw an error up to stack BUT nothing happens on client and on the server console.
ES6 CLASS:

export var SMSController = class _SMSController {
    constructor(companyId) {
       throw new Meteor.Error(500);
    }
}

METEOR METHOD:

   import {SMSController} from '/class/SMSController';
    Meteor.methods({
      createInvitationDetails: function (invitationDetails, options = {}) {
                if (options.sms_notice_dates) {
                    let sms = new SMSController(Meteor.getCurrentCompanyId(Meteor.userId()));
                }
      }
    })

Have you tried adding some debugging to your constructor function to make sure it’s being called properly first?

export class SMSController {
  constructor(companyId) {
    console.log(`Constructor called with ${companyId}`);
    throw new Meteor.Error(500);
  }
}

ofc, console.log() work perfectly

Something else must be impacting your constructor call then. I’ve created a quick repro based on your code approach/structure, and it’s working properly. I’ve removed your options.sms_notice_dates check just to make sure, and everything works as it should. Quick test steps:

  1. meteor create meteor-forum-26966-meteor-error

  2. Create a /class directory.

  3. Within /class, create sms_controller.js:

export class SMSController {
  constructor(companyId) {
    console.log(`Constructor called with ${companyId}`);
    throw new Meteor.Error(500);
  }
}
  1. Within /class, create methods.js:
import { SMSController } from '/class/sms_controller';

Meteor.methods({
  createInvitationDetails(invitationDetails, options = {}) {
    const sms = new SMSController(123);
  }
});
  1. Start your app, then call the following from your browser console:
Meteor.call('createInvitationDetails');

You will get a 500 error, as attached.

Small side note - you might want to look over Meteor 1.3+'s new application structure options. I noticed you’re currently using imports/exports but not leveraging Meteor’s newer /import directory approach.

THX VERY MUCH , problem was here:

Meteor.call('createInvitationDetails', invitationDetails, options, function (err, result) {
  if (err) {
     // console.log(err);
  }
}