mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Meteor.Error will not be encoded in EJSON. We are relying on how it encodes as
EJSON already. Make this clear.
This commit is contained in:
@@ -109,6 +109,11 @@ Meteor._stringifyDDP = function (msg) {
|
||||
|
||||
Meteor._CurrentInvocation = new Meteor.EnvironmentVariable;
|
||||
|
||||
// Note: The DDP server assumes that Meteor.Error EJSON-serializes as an object
|
||||
// containing 'error' and optionally 'reason' and 'details'.
|
||||
// The DDP client manually puts these into Meteor.Error objects. (We don't use
|
||||
// EJSON.addType here because the type is determined by location in the
|
||||
// protocol, not text on the wire.)
|
||||
Meteor.Error = function (error, reason, details) {
|
||||
var self = this;
|
||||
|
||||
|
||||
@@ -1191,7 +1191,6 @@ _.extend(Meteor._LivedataConnection.prototype, {
|
||||
currentMethodBlock.splice(i, 1);
|
||||
|
||||
if (_.has(msg, 'error')) {
|
||||
// XXX should we hook Meteor.Error in to EJSON?
|
||||
m.receiveResult(new Meteor.Error(
|
||||
msg.error.error, msg.error.reason,
|
||||
msg.error.details));
|
||||
|
||||
@@ -1418,7 +1418,7 @@ Tinytest.add("livedata stub - subscribe failure", function (test) {
|
||||
|
||||
// Reject the sub.
|
||||
stream.receive({msg: 'nosub', id: subMessage.id,
|
||||
error: {error: 404, reason: "Subscription not found"}});
|
||||
error: new Meteor.Error(404, "Subscription not found")});
|
||||
test.isFalse(onReadyFired);
|
||||
test.instanceOf(subError, Meteor.Error);
|
||||
test.equal(subError.error, 404);
|
||||
|
||||
@@ -569,7 +569,7 @@ _.extend(Meteor._LivedataSession.prototype, {
|
||||
if (!handler) {
|
||||
self.send({
|
||||
msg: 'result', id: msg.id,
|
||||
error: {error: 404, reason: "Method not found"}});
|
||||
error: new Meteor.Error(404, "Method not found")});
|
||||
fence.arm();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ Package.describe({
|
||||
Package.on_use(function (api, where) {
|
||||
where = where || ["client", "server"];
|
||||
|
||||
api.use('ejson');
|
||||
|
||||
// XXX These files have various dependencies on other packages
|
||||
// that aren't specified here. :(
|
||||
// This package should probably get split into several packages,
|
||||
|
||||
@@ -36,7 +36,7 @@ _.extend(Meteor._StubStream.prototype, {
|
||||
var self = this;
|
||||
|
||||
if (typeof data === 'object') {
|
||||
data = JSON.stringify(data);
|
||||
data = EJSON.stringify(data);
|
||||
}
|
||||
|
||||
_.each(self.callbacks['message'], function (cb) {
|
||||
|
||||
Reference in New Issue
Block a user