Skip to content

Commit

Permalink
feat(fc2): add panic in case a nil error is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkness4 committed Nov 1, 2023
1 parent 8ee0fd8 commit 4454756
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fc2/fc2.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ func (f *FC2) HandleWS(
g, ctx := errgroup.WithContext(ctx)
g.Go(func() error {
err := ws.HeartbeatLoop(ctx, conn, msgChan)
if err == nil {
f.log.Panic().Msg(
"undefined behavior, heartbeat finished with nil, the download MUST finish with io.EOF or Canceled",
)
}
if err == io.EOF {
f.log.Info().Msg("healthcheck finished")
} else if errors.Is(err, context.Canceled) {
Expand Down

0 comments on commit 4454756

Please sign in to comment.