fix some error handling

This commit is contained in:
Specode 2013-11-04 15:13:55 +08:00
parent 64821d5df9
commit b67dc40516

View File

@ -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: