What does sanitizedError mean, and how to use it?


#1

HI,
Can anyone help to explain the following chappter from meteor doc? what do “mapped to a sanitized version on the wire” and “sanitizedError field” mean?

I understand how to create an Meteor.Error and have it returned to the client, but I just want to understand this part so that I can be sure there won’t be any traps.

Thanks for your help!

If a method function throws a different exception, then it will be mapped to a sanitized version on the wire. Specifically, if the sanitizedError field on the thrown error is set to a Meteor.Error, then that error will be sent to the client. Otherwise, if no sanitized version is available, the client gets Meteor.Error(500, ‘Internal server error’).


#2

And, if you throw it at the server in the end of a promise chain, in a …catch, why does the server crash?..


#3

I’d like to understand this doc extract too !