TBR wspr: Change IPC protocol to remove error from out-args.
This is related to:
https://vanadium-review.googlesource.com/#/c/4751/
The changes in wspr aren't just trivial VDL generation. Luckily
Benj had the foresight to add TODO comments around most places
where we were hacking things by adding / removing the final error
out-arg. So I've just found these places and removed the hacks.
AFAICT the javascript code itself doesn't need to change, since
Benj had already set things up assuming that we'd make this
change at some point. All go tests pass, but I'm just going to
wait for the presubmit to make sure the JS side really passes.
MultiPart: 2/8
Change-Id: Id888b4e86f290bd8931de821c668f4b8829b6c5f
diff --git a/services/wsprd/app/app.go b/services/wsprd/app/app.go
index 9d50c87..05f30ac 100644
--- a/services/wsprd/app/app.go
+++ b/services/wsprd/app/app.go
@@ -168,13 +168,9 @@
w.Error(verror.New(marshallingError, ctx, "ResponseStreamClose"))
}
}
-
- // TODO(bprosnitz) Remove this when we remove error from out args everywhere.
- numOutArgsWithError := msg.NumOutArgs + 1
-
- results := make([]interface{}, numOutArgsWithError)
+ results := make([]interface{}, msg.NumOutArgs)
// This array will have pointers to the values in result.
- resultptrs := make([]interface{}, numOutArgsWithError)
+ resultptrs := make([]interface{}, msg.NumOutArgs)
for ax := range results {
resultptrs[ax] = &results[ax]
}
@@ -187,14 +183,7 @@
}
func (c *Controller) sendRPCResponse(ctx *context.T, w lib.ClientWriter, span vtrace.Span, results []interface{}) {
- // for now we assume last out argument is always error
- if err, ok := results[len(results)-1].(error); ok {
- // return the call Application error as is
- w.Error(err)
- return
- }
-
- outargs := make([]vdl.AnyRep, len(results)-1)
+ outargs := make([]vdl.AnyRep, len(results))
for i := range outargs {
outargs[i] = results[i]
}