Skip to content

Commit

Permalink
plugin: fix the params conversion
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed Mar 4, 2024
1 parent 878fa7f commit 6edd512
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion comm/jsonrpcv2/jsonrpcv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (instance *Request) GetParams() map[string]any {
case map[string]any:
return params
case []any:
if len(params) == 0 {
if len(params) != 0 {
panic(fmt.Sprintf("%s", params))
}
return map[string]any{}
Expand Down
1 change: 1 addition & 0 deletions plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func (self *Plugin[T]) Start() {

var request Request
if err := self.encoder.DecodeFromBytes(rawRequest, &request); err != nil {
self.Log("broken", fmt.Sprintf("%s", err))
panic(fmt.Sprintf("Error parsing request: %s input %s", err, string(rawRequest)))
}
if request.Id != nil {
Expand Down

0 comments on commit 6edd512

Please sign in to comment.