@@ -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
@@ -304,7 +304,7 @@ func (s *SerialConsistency) UnmarshalText(text []byte) error {
304304 case "LOCAL_SERIAL" :
305305 * s = LocalSerial
306306 default :
307- return fmt .Errorf ("invalid consistency %q" , string (text ))
307+ return fmt .Errorf ("gocql: invalid consistency %q" , string (text ))
308308 }
309309
310310 return nil
@@ -315,7 +315,7 @@ const (
315315)
316316
317317var (
318- ErrFrameTooBig = errors .New ("frame length is bigger than the maximum allowed" )
318+ ErrFrameTooBig = errors .New ("gocql: frame length is bigger than the maximum allowed" )
319319)
320320
321321const maxFrameHeaderSize = 9
@@ -458,15 +458,15 @@ func readHeader(r io.Reader, p []byte) (head frameHeader, err error) {
458458
459459 if version > protoVersion2 {
460460 if len (p ) != 9 {
461- return frameHeader {}, fmt .Errorf ("not enough bytes to read header require 9 got: %d" , len (p ))
461+ return frameHeader {}, fmt .Errorf ("gocql: not enough bytes to read header require 9 got: %d" , len (p ))
462462 }
463463
464464 head .stream = int (int16 (p [2 ])<< 8 | int16 (p [3 ]))
465465 head .op = frameOp (p [4 ])
466466 head .length = int (readInt (p [5 :]))
467467 } else {
468468 if len (p ) != 8 {
469- return frameHeader {}, fmt .Errorf ("not enough bytes to read header require 8 got: %d" , len (p ))
469+ return frameHeader {}, fmt .Errorf ("gocql: not enough bytes to read header require 8 got: %d" , len (p ))
470470 }
471471
472472 head .stream = int (int8 (p [2 ]))
@@ -490,12 +490,12 @@ func (f *framer) payload() {
490490// reads a frame form the wire into the framers buffer
491491func (f * framer ) readFrame (r io.Reader , head * frameHeader ) error {
492492 if head .length < 0 {
493- return fmt .Errorf ("frame body length can not be less than 0: %d" , head .length )
493+ return fmt .Errorf ("gocql: frame body length can not be less than 0: %d" , head .length )
494494 } else if head .length > maxFrameSize {
495495 // need to free up the connection to be used again
496496 _ , err := io .CopyN (ioutil .Discard , r , int64 (head .length ))
497497 if err != nil {
498- return fmt .Errorf ("error whilst trying to discard frame with invalid length: %v " , err )
498+ return fmt .Errorf ("gocql: error whilst trying to discard frame with invalid length: %w " , err )
499499 }
500500 return ErrFrameTooBig
501501 }
@@ -510,7 +510,7 @@ func (f *framer) readFrame(r io.Reader, head *frameHeader) error {
510510 // assume the underlying reader takes care of timeouts and retries
511511 n , err := io .ReadFull (r , f .buf )
512512 if err != nil {
513- return fmt .Errorf ("unable to read frame body: read %d/%d bytes: %v " , n , head .length , err )
513+ return fmt .Errorf ("gocql: unable to read frame body: read %d/%d bytes: %w " , n , head .length , err )
514514 }
515515
516516 if head .flags & flagCompress == flagCompress {
@@ -520,7 +520,7 @@ func (f *framer) readFrame(r io.Reader, head *frameHeader) error {
520520
521521 f .buf , err = f .compres .Decode (f .buf )
522522 if err != nil {
523- return err
523+ return fmt . Errorf ( "gocql: %w" , err )
524524 }
525525 }
526526
@@ -696,7 +696,7 @@ func (f *framer) parseErrorFrame() frame {
696696 // TODO(zariel): we should have some distinct types for these errors
697697 return errD
698698 default :
699- panic (fmt .Errorf ("unknown error code: 0x%x" , errD .code ))
699+ panic (fmt .Errorf ("gocql: unknown error code: 0x%x" , errD .code ))
700700 }
701701}
702702
@@ -765,7 +765,7 @@ func (f *framer) finish() error {
765765 // TODO: only compress frames which are big enough
766766 compressed , err := f .compres .Encode (f .buf [f .headSize :])
767767 if err != nil {
768- return err
768+ return fmt . Errorf ( "gocql: %w" , err )
769769 }
770770
771771 f .buf = append (f .buf [:f .headSize ], compressed ... )
@@ -845,7 +845,7 @@ func (w *writePrepareFrame) buildFrame(f *framer, streamID int) error {
845845 if f .proto > protoVersion4 {
846846 flags |= flagWithPreparedKeyspace
847847 } else {
848- panic (fmt .Errorf ("the keyspace can only be set with protocol 5 or higher" ))
848+ panic (fmt .Errorf ("gocql: the keyspace can only be set with protocol 5 or higher" ))
849849 }
850850 }
851851 if f .proto > protoVersion4 {
@@ -944,7 +944,7 @@ func (f *framer) parsePreparedMetadata() preparedMetadata {
944944 meta .flags = f .readInt ()
945945 meta .colCount = f .readInt ()
946946 if meta .colCount < 0 {
947- panic (fmt .Errorf ("received negative column count: %d" , meta .colCount ))
947+ panic (fmt .Errorf ("gocql: received negative column count: %d" , meta .colCount ))
948948 }
949949 meta .actualColCount = meta .colCount
950950
@@ -1041,7 +1041,7 @@ func (f *framer) parseResultMetadata() resultMetadata {
10411041 meta .flags = f .readInt ()
10421042 meta .colCount = f .readInt ()
10431043 if meta .colCount < 0 {
1044- panic (fmt .Errorf ("received negative column count: %d" , meta .colCount ))
1044+ panic (fmt .Errorf ("gocql: received negative column count: %d" , meta .colCount ))
10451045 }
10461046 meta .actualColCount = meta .colCount
10471047
@@ -1128,7 +1128,7 @@ func (f *framer) parseResultRows() frame {
11281128
11291129 result .numRows = f .readInt ()
11301130 if result .numRows < 0 {
1131- panic (fmt .Errorf ("invalid row_count in result frame: %d" , result .numRows ))
1131+ panic (fmt .Errorf ("gocql: invalid row_count in result frame: %d" , result .numRows ))
11321132 }
11331133
11341134 return result
@@ -1496,7 +1496,7 @@ func (f *framer) writeQueryParams(opts *queryParams) {
14961496 if f .proto > protoVersion4 {
14971497 flags |= flagWithKeyspace
14981498 } else {
1499- panic (fmt .Errorf ("the keyspace can only be set with protocol 5 or higher" ))
1499+ panic (fmt .Errorf ("gocql: the keyspace can only be set with protocol 5 or higher" ))
15001500 }
15011501 }
15021502
@@ -1759,7 +1759,7 @@ func (f *framer) writeRegisterFrame(streamID int, w *writeRegisterFrame) error {
17591759
17601760func (f * framer ) readByte () byte {
17611761 if len (f .buf ) < 1 {
1762- panic (fmt .Errorf ("not enough bytes in buffer to read byte require 1 got: %d" , len (f .buf )))
1762+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read byte require 1 got: %d" , len (f .buf )))
17631763 }
17641764
17651765 b := f .buf [0 ]
@@ -1769,7 +1769,7 @@ func (f *framer) readByte() byte {
17691769
17701770func (f * framer ) readInt () (n int ) {
17711771 if len (f .buf ) < 4 {
1772- panic (fmt .Errorf ("not enough bytes in buffer to read int require 4 got: %d" , len (f .buf )))
1772+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read int require 4 got: %d" , len (f .buf )))
17731773 }
17741774
17751775 n = int (int32 (f .buf [0 ])<< 24 | int32 (f .buf [1 ])<< 16 | int32 (f .buf [2 ])<< 8 | int32 (f .buf [3 ]))
@@ -1779,7 +1779,7 @@ func (f *framer) readInt() (n int) {
17791779
17801780func (f * framer ) readShort () (n uint16 ) {
17811781 if len (f .buf ) < 2 {
1782- panic (fmt .Errorf ("not enough bytes in buffer to read short require 2 got: %d" , len (f .buf )))
1782+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read short require 2 got: %d" , len (f .buf )))
17831783 }
17841784 n = uint16 (f .buf [0 ])<< 8 | uint16 (f .buf [1 ])
17851785 f .buf = f .buf [2 :]
@@ -1790,7 +1790,7 @@ func (f *framer) readString() (s string) {
17901790 size := f .readShort ()
17911791
17921792 if len (f .buf ) < int (size ) {
1793- panic (fmt .Errorf ("not enough bytes in buffer to read string require %d got: %d" , size , len (f .buf )))
1793+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read string require %d got: %d" , size , len (f .buf )))
17941794 }
17951795
17961796 s = string (f .buf [:size ])
@@ -1802,7 +1802,7 @@ func (f *framer) readLongString() (s string) {
18021802 size := f .readInt ()
18031803
18041804 if len (f .buf ) < size {
1805- panic (fmt .Errorf ("not enough bytes in buffer to read long string require %d got: %d" , size , len (f .buf )))
1805+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read long string require %d got: %d" , size , len (f .buf )))
18061806 }
18071807
18081808 s = string (f .buf [:size ])
@@ -1812,7 +1812,7 @@ func (f *framer) readLongString() (s string) {
18121812
18131813func (f * framer ) readUUID () * UUID {
18141814 if len (f .buf ) < 16 {
1815- panic (fmt .Errorf ("not enough bytes in buffer to read uuid require %d got: %d" , 16 , len (f .buf )))
1815+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read uuid require %d got: %d" , 16 , len (f .buf )))
18161816 }
18171817
18181818 // TODO: how to handle this error, if it is a uuid, then sureley, problems?
@@ -1839,7 +1839,7 @@ func (f *framer) readBytesInternal() ([]byte, error) {
18391839 }
18401840
18411841 if len (f .buf ) < size {
1842- return nil , fmt .Errorf ("not enough bytes in buffer to read bytes require %d got: %d" , size , len (f .buf ))
1842+ return nil , fmt .Errorf ("gocql: not enough bytes in buffer to read bytes require %d got: %d" , size , len (f .buf ))
18431843 }
18441844
18451845 l := f .buf [:size ]
@@ -1860,7 +1860,7 @@ func (f *framer) readBytes() []byte {
18601860func (f * framer ) readShortBytes () []byte {
18611861 size := f .readShort ()
18621862 if len (f .buf ) < int (size ) {
1863- panic (fmt .Errorf ("not enough bytes in buffer to read short bytes: require %d got %d" , size , len (f .buf )))
1863+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read short bytes: require %d got %d" , size , len (f .buf )))
18641864 }
18651865
18661866 l := f .buf [:size ]
@@ -1871,18 +1871,18 @@ func (f *framer) readShortBytes() []byte {
18711871
18721872func (f * framer ) readInetAdressOnly () net.IP {
18731873 if len (f .buf ) < 1 {
1874- panic (fmt .Errorf ("not enough bytes in buffer to read inet size require %d got: %d" , 1 , len (f .buf )))
1874+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read inet size require %d got: %d" , 1 , len (f .buf )))
18751875 }
18761876
18771877 size := f .buf [0 ]
18781878 f .buf = f .buf [1 :]
18791879
18801880 if ! (size == 4 || size == 16 ) {
1881- panic (fmt .Errorf ("invalid IP size: %d" , size ))
1881+ panic (fmt .Errorf ("gocql: invalid IP size: %d" , size ))
18821882 }
18831883
18841884 if len (f .buf ) < 1 {
1885- panic (fmt .Errorf ("not enough bytes in buffer to read inet require %d got: %d" , size , len (f .buf )))
1885+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read inet require %d got: %d" , size , len (f .buf )))
18861886 }
18871887
18881888 ip := make ([]byte , size )
0 commit comments