I don’t quite follow the question - from the small snippet you’re showing, this looks okay. It looks like your insert is failing, at which point your callback function is called with the error object populated, and throws the exception you’ve defined. Are you asking why it’s failing? If that’s the case we’ll need to see more code.
well if i don’t throw a new error it doesn’t get an exception in the server but the error will be a default 500 server error and i kinda wanna do custom errors. And it is hard to parse the error object in the client. I guess i have to try catch the exception in the server and throw my custom error?
There is a flaw in the OP’s code which will result in no data being returned to the Meteor.call - using an async callback in a method is only useful if you do not expect data to be returned (however, it should not result in an exception - so I expect there was some other issue).
I’m pleased you found a solution, but what I’m struggling to understand is why use a callback in the first place? On the server, you can write synchronous-style MongoDB calls, because Meteor wraps these for you.