Skip to content

Commit

Permalink
properly return not authorized error
Browse files Browse the repository at this point in the history
  • Loading branch information
256dpi committed Apr 29, 2018
1 parent f516581 commit a722353
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion broker/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const (
// ConnectPacket.
var ErrExpectedConnect = errors.New("expected a ConnectPacket as the first packet")

// ErrNotAuthorized is returned when a client is not authorized.
var ErrNotAuthorized = errors.New("client is not authorized")

// ErrMissingSession is returned if the backend does not return a session.
var ErrMissingSession = errors.New("no session returned from Backend")

Expand Down Expand Up @@ -206,7 +209,7 @@ func (c *Client) processConnect(pkt *packet.ConnectPacket) error {
}

// close client
return c.die(ClientError, nil, true)
return c.die(ClientError, ErrNotAuthorized, true)
}

// set state
Expand Down

0 comments on commit a722353

Please sign in to comment.