Meteor: Inaccurate DDP documentation for error message format

Created on 17 Jun 2016  路  3Comments  路  Source: meteor/meteor

Hi, I am developing a DDP client library for Unity3D, and I think that some parts of the DDP documentation are no longer accurate and need to be fixed.

This is the message I get from Meteor v1.3.2.4 when I try to subscribe to something that doesn't exist on the server:

{"msg":"nosub","id":"0","error":{"error":404,"reason":"Subscription 'friends' not found","message":"Subscription 'friends' not found [404]","errorType":"Meteor.Error"}}
  1. According to the latest DDP documentation on errors, the field message should not appear.
  2. There is no errorType field in the documentation but I receive it from the server.
few DDP Docs Bug

Most helpful comment

This should be accurate now thanks to #8173. Thanks, @hwillson and @green-coder!

All 3 comments

Thanks for reporting this. I know this issue hasn't got much attention, but I think a well-written pull request for this would be accepted!

Hi guys - if there are errors, results and nosub messages have their error set by creating a new Meteor.Error object. For example, nosub creates a new Meteor.Error like:

self.send({
  msg: 'nosub', id: msg.id,
  error: new Meteor.Error(404, `Subscription '${msg.name}' not found`)});

Since both results and nosub message errors aren't passing in details (3rd param to Meteor.Error), they will always (and only) have:

  • error
  • reason
  • message
  • errorType

I'll submit a PR to adjust the docs. Thanks!

This should be accurate now thanks to #8173. Thanks, @hwillson and @green-coder!

Was this page helpful?
0 / 5 - 0 ratings