Skip to content

Commit

Permalink
fix: return error if no welcome message received
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Aug 15, 2023
1 parent 1e5b70f commit 4efc679
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cable.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ func (c *Cable) Connect(cableUrl string, opts goja.Value) (*Client, error) {
err = client.start()

if err != nil {
return nil, err
logger.Errorf("failed to initialize Action Cable connection: %v", err)
return nil, nil
}

return &client, nil
Expand Down
3 changes: 1 addition & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,7 @@ func (c *Client) receiveWelcomeMsg() error {
}

if obj.Type != "welcome" {
c.logger.Errorf("expected welcome msg, got %v", obj)
return err
return fmt.Errorf("expected welcome msg, got %v", obj)
}

return nil
Expand Down

0 comments on commit 4efc679

Please sign in to comment.