forked from jshiffer/go-xmpp
fix some error handling
This commit is contained in:
parent
64821d5df9
commit
b67dc40516
7
xmpp.go
7
xmpp.go
@ -314,6 +314,9 @@ func (c *Client) init(o *Options) error {
|
||||
|
||||
// Next message should be either success or failure.
|
||||
name, val, err := next(c.p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch v := val.(type) {
|
||||
case *saslSuccess:
|
||||
case *saslFailure:
|
||||
@ -535,8 +538,8 @@ type clientError struct {
|
||||
func nextStart(p *xml.Decoder) (xml.StartElement, error) {
|
||||
for {
|
||||
t, err := p.Token()
|
||||
if err != nil {
|
||||
log.Fatal("token", err)
|
||||
if err != nil && err != io.EOF {
|
||||
return nil, err
|
||||
}
|
||||
switch t := t.(type) {
|
||||
case xml.StartElement:
|
||||
|
Loading…
Reference in New Issue
Block a user