Skip to content

Commit

Permalink
Always return argument responses as complete array.
Browse files Browse the repository at this point in the history
All eebus-go functions will now return a JSON array which includes all
return parameters including any error values.

NOTE: This is a breaking change
  • Loading branch information
sthelen-enqs committed Oct 28, 2024
1 parent 44c4778 commit 7abed76
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions cmd/remote/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"context"
"fmt"
"log"
"strings"
"time"

Expand Down Expand Up @@ -152,20 +151,6 @@ func (r *Remote) handleRPC(ctx context.Context, req *jsonrpc2.Request) (interfac
switch numOut {
case 0:
resp = []interface{}{}
case 1:
resp = output[0]
log.Printf("resp: %v", resp)
case 2:
if output[1] == nil {
resp = output[0]
} else {
if err, ok := output[1].(error); ok {
log.Printf("error handling %v: %v", req.Method, err)
return nil, jsonrpc2.ErrInternal
} else {
resp = output
}
}
default:
resp = output
}
Expand Down

0 comments on commit 7abed76

Please sign in to comment.