Переглянути джерело

Updated conn.go to use new error syntax

Nimi Wariboko Jr 11 роки тому
батько
коміт
ebd7b8e505
1 змінених файлів з 2 додано та 4 видалено
  1. 2 4
      conn.go

+ 2 - 4
conn.go

@@ -403,7 +403,7 @@ func (c *Conn) executeQuery(qry *Query) *Iter {
 	case resultKeyspaceFrame:
 		return &Iter{}
 	case errorFrame:
-		if x.Code == errUnprepared && len(qry.values) > 0 {
+		if x.Code() == errUnprepared && len(qry.values) > 0 {
 			c.prepMu.Lock()
 			if val, ok := c.prep[qry.stmt]; ok && val != nil {
 				delete(c.prep, qry.stmt)
@@ -587,9 +587,7 @@ func (c *Conn) decodeFrame(f frame, trace Tracer) (rval interface{}, err error)
 	case opSupported:
 		return supportedFrame{}, nil
 	case opError:
-		code := f.readInt()
-		msg := f.readString()
-		return errorFrame{code, msg}, nil
+		return f.readError(), nil
 	default:
 		return nil, NewErrProtocol("Decoding frame: unknown op", op)
 	}