Improved error signalling

This commit is contained in:
Tony Garnock-Jones 2019-06-12 00:22:53 +01:00
parent 7cfa084558
commit 409aa357db
2 changed files with 5 additions and 5 deletions

View File

@ -312,8 +312,8 @@ spawn named '@syndicate-lang/server/federation/ScopeFactory' {
field this.linkSubs = Map(); field this.linkSubs = Map();
field this.linkMatches = Map(); field this.linkMatches = Map();
const err = (detail) => { const err = (detail, context) => {
send P.Proposal(managementScope, P.ToPOA(linkid, W.Err(detail))); send P.Proposal(managementScope, P.ToPOA(linkid, W.Err(detail, context || false)));
turn.reset(); turn.reset();
currentFacet().stop(); currentFacet().stop();
}; };
@ -400,7 +400,7 @@ spawn named '@syndicate-lang/server/federation/ScopeFactory' {
const captures = W.Add._captures(item); const captures = W.Add._captures(item);
const matches = this.linkMatches.get(localid) || Set(); const matches = this.linkMatches.get(localid) || Set();
if (matches.includes(captures)) { if (matches.includes(captures)) {
err(Symbol.for('duplicate-capture')); err(Symbol.for('duplicate-capture'), item);
} else { } else {
this.linkMatches = this.linkMatches.set(localid, matches.add(captures)); this.linkMatches = this.linkMatches.set(localid, matches.add(captures));
callWithSub(localid, linkid, (sub) => { callWithSub(localid, linkid, (sub) => {
@ -431,7 +431,7 @@ spawn named '@syndicate-lang/server/federation/ScopeFactory' {
const captures = W.Del._captures(item); const captures = W.Del._captures(item);
const matches = this.linkMatches.get(localid) || Set(); const matches = this.linkMatches.get(localid) || Set();
if (!matches.includes(captures)) { if (!matches.includes(captures)) {
err(Symbol.for('nonexistent-capture')); err(Symbol.for('nonexistent-capture'), item);
} else { } else {
const newMatches = matches.remove(captures); const newMatches = matches.remove(captures);
this.linkMatches = (newMatches.isEmpty()) this.linkMatches = (newMatches.isEmpty())

View File

@ -14,7 +14,7 @@ message type Add(endpointName, captures);
message type Del(endpointName, captures); message type Del(endpointName, captures);
message type Msg(endpointName, captures); message type Msg(endpointName, captures);
message type End(endpointName); message type End(endpointName);
message type Err(detail); message type Err(detail, context);
message type Ping(); message type Ping();
message type Pong(); message type Pong();