mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 12:55:29 +00:00
upgrade osc-go library to v0.3.0 and handle new error cases
This commit is contained in:
2
go.mod
2
go.mod
@@ -12,7 +12,7 @@ require (
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
github.com/jwetzell/artnet-go v0.2.1
|
||||
github.com/jwetzell/free-d-go v0.1.0
|
||||
github.com/jwetzell/osc-go v0.2.0
|
||||
github.com/jwetzell/osc-go v0.3.0
|
||||
github.com/jwetzell/psn-go v0.3.0
|
||||
github.com/nats-io/nats-server/v2 v2.12.6
|
||||
github.com/nats-io/nats.go v1.50.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -71,8 +71,8 @@ github.com/jwetzell/artnet-go v0.2.1 h1:iYTKWcwYrF5kBkYfkw2UbWvoueeA23iKEn7fR27m
|
||||
github.com/jwetzell/artnet-go v0.2.1/go.mod h1:gli97Z32a0kMkZ6taoTiK7/lqHcF/dhiGjGJdx/PxqA=
|
||||
github.com/jwetzell/free-d-go v0.1.0 h1:xHt6dvyit98X+OC3jVzV0aLidxbyzi3vI9QiYkteEtA=
|
||||
github.com/jwetzell/free-d-go v0.1.0/go.mod h1:KmrkooRARRaxJTBSPvwt/6IMAIaHH1R8bSA8cwbbELw=
|
||||
github.com/jwetzell/osc-go v0.2.0 h1:4as+BYCeZhEddFczGveP5yZZxvY728Uavz+ZSLZfOII=
|
||||
github.com/jwetzell/osc-go v0.2.0/go.mod h1:D3ZIXYB12bt4S35lKFUqgCFbF1Y+9Ld0sOhHA9mGZZM=
|
||||
github.com/jwetzell/osc-go v0.3.0 h1:z75TxuQSEmdcmZ56OAepkDa3m88SdZh//3m4nBb/XZI=
|
||||
github.com/jwetzell/osc-go v0.3.0/go.mod h1:kCs329JxY6Qjga08tRQ/Gl0PqhgQzLIMpOhm6uszvIc=
|
||||
github.com/jwetzell/psn-go v0.3.0 h1:WVpCEmExYE8a+I5hQak5jNJJp2x35VdGX/VuMUKPmhY=
|
||||
github.com/jwetzell/psn-go v0.3.0/go.mod h1:bcEAeti4sQM375buujb3mIfmUstD4Aby18gq3ENb6+o=
|
||||
github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE=
|
||||
|
||||
@@ -3,6 +3,7 @@ package processor
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
osc "github.com/jwetzell/osc-go"
|
||||
"github.com/jwetzell/showbridge-go/internal/common"
|
||||
@@ -22,7 +23,12 @@ func (ome *OSCMessageEncode) Process(ctx context.Context, wrappedPayload common.
|
||||
return wrappedPayload, errors.New("osc.message.encode processor only accepts an *OSCMessage")
|
||||
}
|
||||
|
||||
wrappedPayload.Payload = payloadMessage.ToBytes()
|
||||
bytes, err := payloadMessage.ToBytes()
|
||||
if err != nil {
|
||||
wrappedPayload.End = true
|
||||
return wrappedPayload, fmt.Errorf("osc.message.encode processor failed to encode OSCMessage: %w", err)
|
||||
}
|
||||
wrappedPayload.Payload = bytes
|
||||
return wrappedPayload, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ func TestBadOSCMessageDecode(t *testing.T) {
|
||||
{
|
||||
name: "invalid OSC payload",
|
||||
payload: []byte{47, 116, 101, 115, 116, 0},
|
||||
errorString: "osc.message.decode processor failed to decode OSC message: string data is not properly padded",
|
||||
errorString: "osc.message.decode processor failed to decode OSC message: OSC string is not properly padded",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,14 @@ func TestBadOSCMessageEncode(t *testing.T) {
|
||||
payload: "test",
|
||||
errorString: "osc.message.encode processor only accepts an *OSCMessage",
|
||||
},
|
||||
{
|
||||
name: "invalid OSC message argument",
|
||||
payload: &osc.OSCMessage{
|
||||
Address: "test",
|
||||
Args: []osc.OSCArg{},
|
||||
},
|
||||
errorString: "osc.message.encode processor failed to encode OSCMessage: OSC Message address must start with /",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
||||
Reference in New Issue
Block a user