Skip to content

Commit

Permalink
fix: OnError message is not called in subscriptions-transport-ws (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
tangxusc committed Apr 20, 2023
1 parent 00bd4a0 commit 1741410
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions subscriptions_transport_ws.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ func (stw *subscriptionsTransportWS) OnMessage(ctx *SubscriptionContext, subscri
switch message.Type {
case GQLError:
ctx.Log(message, "server", GQLError)
var errs Errors
jsonErr := json.Unmarshal(message.Payload, &errs)
if jsonErr != nil {
subscription.handler(nil, fmt.Errorf("%s", string(message.Payload)))
return nil
}
if len(errs) > 0 {
subscription.handler(nil, errs)
return nil
}
case GQLData:
ctx.Log(message, "server", GQLData)
var out struct {
Expand Down

0 comments on commit 1741410

Please sign in to comment.