A Meteor package that extends Mongo.Collection to provide support for specifying a schema and then validating against that schema when inserting and updating.
Because of this block, all exceptions that would throw on the server when calling Collection.update without a callback instead log on the client instead, which is inconsistent and breaks simulated methods.
The comment for the same block claims "Client can't block, so it can't report errors by exception" is misleading. In simulated methods the client can report errors by exception just fine.
The default for meteor:validatedMethods is for throwStubExceptions to be true, which should prevent methods that error on the client from being sent to the server, but because of the enforced callback on update and insert collection methods, the client cannot simulate the server's behavior correctly.
To Reproduce
Call Collection.update( ) in a validated method using an update that does not match the schema
The update succeeds on the client, but logs an error, and then throws the same error on the server which gets returned to the client's method callback
Expected behavior
Collection.update should throw an error consistently on both the client and the server when used without a callback.
Because of this block, all exceptions that would throw on the server when calling
Collection.update
without a callback instead log on the client instead, which is inconsistent and breaks simulated methods.The comment for the same block claims "Client can't block, so it can't report errors by exception" is misleading. In simulated methods the client can report errors by exception just fine.
The default for meteor:validatedMethods is for
throwStubExceptions
to be true, which should prevent methods that error on the client from being sent to the server, but because of the enforced callback on update and insert collection methods, the client cannot simulate the server's behavior correctly.To Reproduce
Collection.update( )
in a validated method using an update that does not match the schemaExpected behavior
Collection.update should throw an error consistently on both the client and the server when used without a callback.