Skip to content

Stub exceptions are logged instead of thrown in Meteor Methods, preventing throwStubExceptions from working as intended #438

@ThaumRystra

Description

@ThaumRystra

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

  1. Call Collection.update( ) in a validated method using an update that does not match the schema
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions