From 409aa357db5b9c1364e8b1febb1ed36818a07781 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 12 Jun 2019 00:22:53 +0100 Subject: [PATCH] Improved error signalling --- packages/server/src/federation.js | 8 ++++---- packages/server/src/protocol.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/server/src/federation.js b/packages/server/src/federation.js index 2b77afe..3bc4793 100644 --- a/packages/server/src/federation.js +++ b/packages/server/src/federation.js @@ -312,8 +312,8 @@ spawn named '@syndicate-lang/server/federation/ScopeFactory' { field this.linkSubs = Map(); field this.linkMatches = Map(); - const err = (detail) => { - send P.Proposal(managementScope, P.ToPOA(linkid, W.Err(detail))); + const err = (detail, context) => { + send P.Proposal(managementScope, P.ToPOA(linkid, W.Err(detail, context || false))); turn.reset(); currentFacet().stop(); }; @@ -400,7 +400,7 @@ spawn named '@syndicate-lang/server/federation/ScopeFactory' { const captures = W.Add._captures(item); const matches = this.linkMatches.get(localid) || Set(); if (matches.includes(captures)) { - err(Symbol.for('duplicate-capture')); + err(Symbol.for('duplicate-capture'), item); } else { this.linkMatches = this.linkMatches.set(localid, matches.add(captures)); callWithSub(localid, linkid, (sub) => { @@ -431,7 +431,7 @@ spawn named '@syndicate-lang/server/federation/ScopeFactory' { const captures = W.Del._captures(item); const matches = this.linkMatches.get(localid) || Set(); if (!matches.includes(captures)) { - err(Symbol.for('nonexistent-capture')); + err(Symbol.for('nonexistent-capture'), item); } else { const newMatches = matches.remove(captures); this.linkMatches = (newMatches.isEmpty()) diff --git a/packages/server/src/protocol.js b/packages/server/src/protocol.js index 564d126..1d94fbb 100644 --- a/packages/server/src/protocol.js +++ b/packages/server/src/protocol.js @@ -14,7 +14,7 @@ message type Add(endpointName, captures); message type Del(endpointName, captures); message type Msg(endpointName, captures); message type End(endpointName); -message type Err(detail); +message type Err(detail, context); message type Ping(); message type Pong();