@@ -254,7 +254,7 @@ func (c *Consistency) UnmarshalText(text []byte) error {
254254 case "LOCAL_ONE" :
255255 * c = LocalOne
256256 default :
257- return fmt .Errorf ("invalid consistency %q" , string (text ))
257+ return fmt .Errorf ("gocql: invalid consistency %q" , string (text ))
258258 }
259259
260260 return nil
@@ -315,7 +315,7 @@ func (s *SerialConsistency) UnmarshalText(text []byte) error {
315315 case "LOCAL_SERIAL" :
316316 * s = LocalSerial
317317 default :
318- return fmt .Errorf ("invalid consistency %q" , string (text ))
318+ return fmt .Errorf ("gocql: invalid consistency %q" , string (text ))
319319 }
320320
321321 return nil
@@ -326,7 +326,7 @@ const (
326326)
327327
328328var (
329- ErrFrameTooBig = errors .New ("frame length is bigger than the maximum allowed" )
329+ ErrFrameTooBig = errors .New ("gocql: frame length is bigger than the maximum allowed" )
330330)
331331
332332const maxFrameHeaderSize = 9
@@ -469,15 +469,15 @@ func readHeader(r io.Reader, p []byte) (head frameHeader, err error) {
469469
470470 if version > protoVersion2 {
471471 if len (p ) != 9 {
472- return frameHeader {}, fmt .Errorf ("not enough bytes to read header require 9 got: %d" , len (p ))
472+ return frameHeader {}, fmt .Errorf ("gocql: not enough bytes to read header require 9 got: %d" , len (p ))
473473 }
474474
475475 head .stream = int (int16 (p [2 ])<< 8 | int16 (p [3 ]))
476476 head .op = frameOp (p [4 ])
477477 head .length = int (readInt (p [5 :]))
478478 } else {
479479 if len (p ) != 8 {
480- return frameHeader {}, fmt .Errorf ("not enough bytes to read header require 8 got: %d" , len (p ))
480+ return frameHeader {}, fmt .Errorf ("gocql: not enough bytes to read header require 8 got: %d" , len (p ))
481481 }
482482
483483 head .stream = int (int8 (p [2 ]))
@@ -501,12 +501,12 @@ func (f *framer) payload() {
501501// reads a frame form the wire into the framers buffer
502502func (f * framer ) readFrame (r io.Reader , head * frameHeader ) error {
503503 if head .length < 0 {
504- return fmt .Errorf ("frame body length can not be less than 0: %d" , head .length )
504+ return fmt .Errorf ("gocql: frame body length can not be less than 0: %d" , head .length )
505505 } else if head .length > maxFrameSize {
506506 // need to free up the connection to be used again
507507 _ , err := io .CopyN (ioutil .Discard , r , int64 (head .length ))
508508 if err != nil {
509- return fmt .Errorf ("error whilst trying to discard frame with invalid length: %v " , err )
509+ return fmt .Errorf ("gocql: error whilst trying to discard frame with invalid length: %w " , err )
510510 }
511511 return ErrFrameTooBig
512512 }
@@ -521,7 +521,7 @@ func (f *framer) readFrame(r io.Reader, head *frameHeader) error {
521521 // assume the underlying reader takes care of timeouts and retries
522522 n , err := io .ReadFull (r , f .buf )
523523 if err != nil {
524- return fmt .Errorf ("unable to read frame body: read %d/%d bytes: %v " , n , head .length , err )
524+ return fmt .Errorf ("gocql: unable to read frame body: read %d/%d bytes: %w " , n , head .length , err )
525525 }
526526
527527 if head .flags & flagCompress == flagCompress {
@@ -531,7 +531,7 @@ func (f *framer) readFrame(r io.Reader, head *frameHeader) error {
531531
532532 f .buf , err = f .compres .Decode (f .buf )
533533 if err != nil {
534- return err
534+ return fmt . Errorf ( "gocql: %w" , err )
535535 }
536536 }
537537
@@ -707,7 +707,7 @@ func (f *framer) parseErrorFrame() frame {
707707 // TODO(zariel): we should have some distinct types for these errors
708708 return errD
709709 default :
710- panic (fmt .Errorf ("unknown error code: 0x%x" , errD .code ))
710+ panic (fmt .Errorf ("gocql: unknown error code: 0x%x" , errD .code ))
711711 }
712712}
713713
@@ -776,7 +776,7 @@ func (f *framer) finish() error {
776776 // TODO: only compress frames which are big enough
777777 compressed , err := f .compres .Encode (f .buf [f .headSize :])
778778 if err != nil {
779- return err
779+ return fmt . Errorf ( "gocql: %w" , err )
780780 }
781781
782782 f .buf = append (f .buf [:f .headSize ], compressed ... )
@@ -856,7 +856,7 @@ func (w *writePrepareFrame) buildFrame(f *framer, streamID int) error {
856856 if f .proto > protoVersion4 {
857857 flags |= flagWithPreparedKeyspace
858858 } else {
859- panic (fmt .Errorf ("the keyspace can only be set with protocol 5 or higher" ))
859+ panic (fmt .Errorf ("gocql: the keyspace can only be set with protocol 5 or higher" ))
860860 }
861861 }
862862 if f .proto > protoVersion4 {
@@ -955,7 +955,7 @@ func (f *framer) parsePreparedMetadata() preparedMetadata {
955955 meta .flags = f .readInt ()
956956 meta .colCount = f .readInt ()
957957 if meta .colCount < 0 {
958- panic (fmt .Errorf ("received negative column count: %d" , meta .colCount ))
958+ panic (fmt .Errorf ("gocql: received negative column count: %d" , meta .colCount ))
959959 }
960960 meta .actualColCount = meta .colCount
961961
@@ -1052,7 +1052,7 @@ func (f *framer) parseResultMetadata() resultMetadata {
10521052 meta .flags = f .readInt ()
10531053 meta .colCount = f .readInt ()
10541054 if meta .colCount < 0 {
1055- panic (fmt .Errorf ("received negative column count: %d" , meta .colCount ))
1055+ panic (fmt .Errorf ("gocql: received negative column count: %d" , meta .colCount ))
10561056 }
10571057 meta .actualColCount = meta .colCount
10581058
@@ -1139,7 +1139,7 @@ func (f *framer) parseResultRows() frame {
11391139
11401140 result .numRows = f .readInt ()
11411141 if result .numRows < 0 {
1142- panic (fmt .Errorf ("invalid row_count in result frame: %d" , result .numRows ))
1142+ panic (fmt .Errorf ("gocql: invalid row_count in result frame: %d" , result .numRows ))
11431143 }
11441144
11451145 return result
@@ -1507,7 +1507,7 @@ func (f *framer) writeQueryParams(opts *queryParams) {
15071507 if f .proto > protoVersion4 {
15081508 flags |= flagWithKeyspace
15091509 } else {
1510- panic (fmt .Errorf ("the keyspace can only be set with protocol 5 or higher" ))
1510+ panic (fmt .Errorf ("gocql: the keyspace can only be set with protocol 5 or higher" ))
15111511 }
15121512 }
15131513
@@ -1770,7 +1770,7 @@ func (f *framer) writeRegisterFrame(streamID int, w *writeRegisterFrame) error {
17701770
17711771func (f * framer ) readByte () byte {
17721772 if len (f .buf ) < 1 {
1773- panic (fmt .Errorf ("not enough bytes in buffer to read byte require 1 got: %d" , len (f .buf )))
1773+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read byte require 1 got: %d" , len (f .buf )))
17741774 }
17751775
17761776 b := f .buf [0 ]
@@ -1780,7 +1780,7 @@ func (f *framer) readByte() byte {
17801780
17811781func (f * framer ) readInt () (n int ) {
17821782 if len (f .buf ) < 4 {
1783- panic (fmt .Errorf ("not enough bytes in buffer to read int require 4 got: %d" , len (f .buf )))
1783+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read int require 4 got: %d" , len (f .buf )))
17841784 }
17851785
17861786 n = int (int32 (f .buf [0 ])<< 24 | int32 (f .buf [1 ])<< 16 | int32 (f .buf [2 ])<< 8 | int32 (f .buf [3 ]))
@@ -1790,7 +1790,7 @@ func (f *framer) readInt() (n int) {
17901790
17911791func (f * framer ) readShort () (n uint16 ) {
17921792 if len (f .buf ) < 2 {
1793- panic (fmt .Errorf ("not enough bytes in buffer to read short require 2 got: %d" , len (f .buf )))
1793+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read short require 2 got: %d" , len (f .buf )))
17941794 }
17951795 n = uint16 (f .buf [0 ])<< 8 | uint16 (f .buf [1 ])
17961796 f .buf = f .buf [2 :]
@@ -1801,7 +1801,7 @@ func (f *framer) readString() (s string) {
18011801 size := f .readShort ()
18021802
18031803 if len (f .buf ) < int (size ) {
1804- panic (fmt .Errorf ("not enough bytes in buffer to read string require %d got: %d" , size , len (f .buf )))
1804+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read string require %d got: %d" , size , len (f .buf )))
18051805 }
18061806
18071807 s = string (f .buf [:size ])
@@ -1813,7 +1813,7 @@ func (f *framer) readLongString() (s string) {
18131813 size := f .readInt ()
18141814
18151815 if len (f .buf ) < size {
1816- panic (fmt .Errorf ("not enough bytes in buffer to read long string require %d got: %d" , size , len (f .buf )))
1816+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read long string require %d got: %d" , size , len (f .buf )))
18171817 }
18181818
18191819 s = string (f .buf [:size ])
@@ -1823,7 +1823,7 @@ func (f *framer) readLongString() (s string) {
18231823
18241824func (f * framer ) readUUID () * UUID {
18251825 if len (f .buf ) < 16 {
1826- panic (fmt .Errorf ("not enough bytes in buffer to read uuid require %d got: %d" , 16 , len (f .buf )))
1826+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read uuid require %d got: %d" , 16 , len (f .buf )))
18271827 }
18281828
18291829 // TODO: how to handle this error, if it is a uuid, then sureley, problems?
@@ -1850,7 +1850,7 @@ func (f *framer) readBytesInternal() ([]byte, error) {
18501850 }
18511851
18521852 if len (f .buf ) < size {
1853- return nil , fmt .Errorf ("not enough bytes in buffer to read bytes require %d got: %d" , size , len (f .buf ))
1853+ return nil , fmt .Errorf ("gocql: not enough bytes in buffer to read bytes require %d got: %d" , size , len (f .buf ))
18541854 }
18551855
18561856 l := f .buf [:size ]
@@ -1871,7 +1871,7 @@ func (f *framer) readBytes() []byte {
18711871func (f * framer ) readShortBytes () []byte {
18721872 size := f .readShort ()
18731873 if len (f .buf ) < int (size ) {
1874- panic (fmt .Errorf ("not enough bytes in buffer to read short bytes: require %d got %d" , size , len (f .buf )))
1874+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read short bytes: require %d got %d" , size , len (f .buf )))
18751875 }
18761876
18771877 l := f .buf [:size ]
@@ -1882,18 +1882,18 @@ func (f *framer) readShortBytes() []byte {
18821882
18831883func (f * framer ) readInetAdressOnly () net.IP {
18841884 if len (f .buf ) < 1 {
1885- panic (fmt .Errorf ("not enough bytes in buffer to read inet size require %d got: %d" , 1 , len (f .buf )))
1885+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read inet size require %d got: %d" , 1 , len (f .buf )))
18861886 }
18871887
18881888 size := f .buf [0 ]
18891889 f .buf = f .buf [1 :]
18901890
18911891 if ! (size == 4 || size == 16 ) {
1892- panic (fmt .Errorf ("invalid IP size: %d" , size ))
1892+ panic (fmt .Errorf ("gocql: invalid IP size: %d" , size ))
18931893 }
18941894
18951895 if len (f .buf ) < 1 {
1896- panic (fmt .Errorf ("not enough bytes in buffer to read inet require %d got: %d" , size , len (f .buf )))
1896+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read inet require %d got: %d" , size , len (f .buf )))
18971897 }
18981898
18991899 ip := make ([]byte , size )
0 commit comments