@@ -234,7 +234,7 @@ func (c *Consistency) UnmarshalText(text []byte) error {
234234 case "LOCAL_ONE" :
235235 * c = LocalOne
236236 default :
237- return fmt .Errorf ("invalid consistency %q" , string (text ))
237+ return fmt .Errorf ("gocql: invalid consistency %q" , string (text ))
238238 }
239239
240240 return nil
@@ -295,7 +295,7 @@ func (s *SerialConsistency) UnmarshalText(text []byte) error {
295295 case "LOCAL_SERIAL" :
296296 * s = LocalSerial
297297 default :
298- return fmt .Errorf ("invalid consistency %q" , string (text ))
298+ return fmt .Errorf ("gocql: invalid consistency %q" , string (text ))
299299 }
300300
301301 return nil
@@ -306,7 +306,7 @@ const (
306306)
307307
308308var (
309- ErrFrameTooBig = errors .New ("frame length is bigger than the maximum allowed" )
309+ ErrFrameTooBig = errors .New ("gocql: frame length is bigger than the maximum allowed" )
310310)
311311
312312const maxFrameHeaderSize = 9
@@ -449,15 +449,15 @@ func readHeader(r io.Reader, p []byte) (head frameHeader, err error) {
449449
450450 if version > protoVersion2 {
451451 if len (p ) != 9 {
452- return frameHeader {}, fmt .Errorf ("not enough bytes to read header require 9 got: %d" , len (p ))
452+ return frameHeader {}, fmt .Errorf ("gocql: not enough bytes to read header require 9 got: %d" , len (p ))
453453 }
454454
455455 head .stream = int (int16 (p [2 ])<< 8 | int16 (p [3 ]))
456456 head .op = frameOp (p [4 ])
457457 head .length = int (readInt (p [5 :]))
458458 } else {
459459 if len (p ) != 8 {
460- return frameHeader {}, fmt .Errorf ("not enough bytes to read header require 8 got: %d" , len (p ))
460+ return frameHeader {}, fmt .Errorf ("gocql: not enough bytes to read header require 8 got: %d" , len (p ))
461461 }
462462
463463 head .stream = int (int8 (p [2 ]))
@@ -481,12 +481,12 @@ func (f *framer) payload() {
481481// reads a frame form the wire into the framers buffer
482482func (f * framer ) readFrame (r io.Reader , head * frameHeader ) error {
483483 if head .length < 0 {
484- return fmt .Errorf ("frame body length can not be less than 0: %d" , head .length )
484+ return fmt .Errorf ("gocql: frame body length can not be less than 0: %d" , head .length )
485485 } else if head .length > maxFrameSize {
486486 // need to free up the connection to be used again
487487 _ , err := io .CopyN (ioutil .Discard , r , int64 (head .length ))
488488 if err != nil {
489- return fmt .Errorf ("error whilst trying to discard frame with invalid length: %v " , err )
489+ return fmt .Errorf ("gocql: error whilst trying to discard frame with invalid length: %w " , err )
490490 }
491491 return ErrFrameTooBig
492492 }
@@ -501,7 +501,7 @@ func (f *framer) readFrame(r io.Reader, head *frameHeader) error {
501501 // assume the underlying reader takes care of timeouts and retries
502502 n , err := io .ReadFull (r , f .buf )
503503 if err != nil {
504- return fmt .Errorf ("unable to read frame body: read %d/%d bytes: %v " , n , head .length , err )
504+ return fmt .Errorf ("gocql: unable to read frame body: read %d/%d bytes: %w " , n , head .length , err )
505505 }
506506
507507 if head .flags & flagCompress == flagCompress {
@@ -511,7 +511,7 @@ func (f *framer) readFrame(r io.Reader, head *frameHeader) error {
511511
512512 f .buf , err = f .compres .Decode (f .buf )
513513 if err != nil {
514- return err
514+ return fmt . Errorf ( "gocql: %w" , err )
515515 }
516516 }
517517
@@ -687,7 +687,7 @@ func (f *framer) parseErrorFrame() frame {
687687 // TODO(zariel): we should have some distinct types for these errors
688688 return errD
689689 default :
690- panic (fmt .Errorf ("unknown error code: 0x%x" , errD .code ))
690+ panic (fmt .Errorf ("gocql: unknown error code: 0x%x" , errD .code ))
691691 }
692692}
693693
@@ -756,7 +756,7 @@ func (f *framer) finish() error {
756756 // TODO: only compress frames which are big enough
757757 compressed , err := f .compres .Encode (f .buf [f .headSize :])
758758 if err != nil {
759- return err
759+ return fmt . Errorf ( "gocql: %w" , err )
760760 }
761761
762762 f .buf = append (f .buf [:f .headSize ], compressed ... )
@@ -836,7 +836,7 @@ func (w *writePrepareFrame) buildFrame(f *framer, streamID int) error {
836836 if f .proto > protoVersion4 {
837837 flags |= flagWithPreparedKeyspace
838838 } else {
839- panic (fmt .Errorf ("the keyspace can only be set with protocol 5 or higher" ))
839+ panic (fmt .Errorf ("gocql: the keyspace can only be set with protocol 5 or higher" ))
840840 }
841841 }
842842 if f .proto > protoVersion4 {
@@ -935,7 +935,7 @@ func (f *framer) parsePreparedMetadata() preparedMetadata {
935935 meta .flags = f .readInt ()
936936 meta .colCount = f .readInt ()
937937 if meta .colCount < 0 {
938- panic (fmt .Errorf ("received negative column count: %d" , meta .colCount ))
938+ panic (fmt .Errorf ("gocql: received negative column count: %d" , meta .colCount ))
939939 }
940940 meta .actualColCount = meta .colCount
941941
@@ -1032,7 +1032,7 @@ func (f *framer) parseResultMetadata() resultMetadata {
10321032 meta .flags = f .readInt ()
10331033 meta .colCount = f .readInt ()
10341034 if meta .colCount < 0 {
1035- panic (fmt .Errorf ("received negative column count: %d" , meta .colCount ))
1035+ panic (fmt .Errorf ("gocql: received negative column count: %d" , meta .colCount ))
10361036 }
10371037 meta .actualColCount = meta .colCount
10381038
@@ -1119,7 +1119,7 @@ func (f *framer) parseResultRows() frame {
11191119
11201120 result .numRows = f .readInt ()
11211121 if result .numRows < 0 {
1122- panic (fmt .Errorf ("invalid row_count in result frame: %d" , result .numRows ))
1122+ panic (fmt .Errorf ("gocql: invalid row_count in result frame: %d" , result .numRows ))
11231123 }
11241124
11251125 return result
@@ -1487,7 +1487,7 @@ func (f *framer) writeQueryParams(opts *queryParams) {
14871487 if f .proto > protoVersion4 {
14881488 flags |= flagWithKeyspace
14891489 } else {
1490- panic (fmt .Errorf ("the keyspace can only be set with protocol 5 or higher" ))
1490+ panic (fmt .Errorf ("gocql: the keyspace can only be set with protocol 5 or higher" ))
14911491 }
14921492 }
14931493
@@ -1750,7 +1750,7 @@ func (f *framer) writeRegisterFrame(streamID int, w *writeRegisterFrame) error {
17501750
17511751func (f * framer ) readByte () byte {
17521752 if len (f .buf ) < 1 {
1753- panic (fmt .Errorf ("not enough bytes in buffer to read byte require 1 got: %d" , len (f .buf )))
1753+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read byte require 1 got: %d" , len (f .buf )))
17541754 }
17551755
17561756 b := f .buf [0 ]
@@ -1760,7 +1760,7 @@ func (f *framer) readByte() byte {
17601760
17611761func (f * framer ) readInt () (n int ) {
17621762 if len (f .buf ) < 4 {
1763- panic (fmt .Errorf ("not enough bytes in buffer to read int require 4 got: %d" , len (f .buf )))
1763+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read int require 4 got: %d" , len (f .buf )))
17641764 }
17651765
17661766 n = int (int32 (f .buf [0 ])<< 24 | int32 (f .buf [1 ])<< 16 | int32 (f .buf [2 ])<< 8 | int32 (f .buf [3 ]))
@@ -1770,7 +1770,7 @@ func (f *framer) readInt() (n int) {
17701770
17711771func (f * framer ) readShort () (n uint16 ) {
17721772 if len (f .buf ) < 2 {
1773- panic (fmt .Errorf ("not enough bytes in buffer to read short require 2 got: %d" , len (f .buf )))
1773+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read short require 2 got: %d" , len (f .buf )))
17741774 }
17751775 n = uint16 (f .buf [0 ])<< 8 | uint16 (f .buf [1 ])
17761776 f .buf = f .buf [2 :]
@@ -1781,7 +1781,7 @@ func (f *framer) readString() (s string) {
17811781 size := f .readShort ()
17821782
17831783 if len (f .buf ) < int (size ) {
1784- panic (fmt .Errorf ("not enough bytes in buffer to read string require %d got: %d" , size , len (f .buf )))
1784+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read string require %d got: %d" , size , len (f .buf )))
17851785 }
17861786
17871787 s = string (f .buf [:size ])
@@ -1793,7 +1793,7 @@ func (f *framer) readLongString() (s string) {
17931793 size := f .readInt ()
17941794
17951795 if len (f .buf ) < size {
1796- panic (fmt .Errorf ("not enough bytes in buffer to read long string require %d got: %d" , size , len (f .buf )))
1796+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read long string require %d got: %d" , size , len (f .buf )))
17971797 }
17981798
17991799 s = string (f .buf [:size ])
@@ -1803,7 +1803,7 @@ func (f *framer) readLongString() (s string) {
18031803
18041804func (f * framer ) readUUID () * UUID {
18051805 if len (f .buf ) < 16 {
1806- panic (fmt .Errorf ("not enough bytes in buffer to read uuid require %d got: %d" , 16 , len (f .buf )))
1806+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read uuid require %d got: %d" , 16 , len (f .buf )))
18071807 }
18081808
18091809 // TODO: how to handle this error, if it is a uuid, then sureley, problems?
@@ -1830,7 +1830,7 @@ func (f *framer) readBytesInternal() ([]byte, error) {
18301830 }
18311831
18321832 if len (f .buf ) < size {
1833- return nil , fmt .Errorf ("not enough bytes in buffer to read bytes require %d got: %d" , size , len (f .buf ))
1833+ return nil , fmt .Errorf ("gocql: not enough bytes in buffer to read bytes require %d got: %d" , size , len (f .buf ))
18341834 }
18351835
18361836 l := f .buf [:size ]
@@ -1851,7 +1851,7 @@ func (f *framer) readBytes() []byte {
18511851func (f * framer ) readShortBytes () []byte {
18521852 size := f .readShort ()
18531853 if len (f .buf ) < int (size ) {
1854- panic (fmt .Errorf ("not enough bytes in buffer to read short bytes: require %d got %d" , size , len (f .buf )))
1854+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read short bytes: require %d got %d" , size , len (f .buf )))
18551855 }
18561856
18571857 l := f .buf [:size ]
@@ -1862,18 +1862,18 @@ func (f *framer) readShortBytes() []byte {
18621862
18631863func (f * framer ) readInetAdressOnly () net.IP {
18641864 if len (f .buf ) < 1 {
1865- panic (fmt .Errorf ("not enough bytes in buffer to read inet size require %d got: %d" , 1 , len (f .buf )))
1865+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read inet size require %d got: %d" , 1 , len (f .buf )))
18661866 }
18671867
18681868 size := f .buf [0 ]
18691869 f .buf = f .buf [1 :]
18701870
18711871 if ! (size == 4 || size == 16 ) {
1872- panic (fmt .Errorf ("invalid IP size: %d" , size ))
1872+ panic (fmt .Errorf ("gocql: invalid IP size: %d" , size ))
18731873 }
18741874
18751875 if len (f .buf ) < 1 {
1876- panic (fmt .Errorf ("not enough bytes in buffer to read inet require %d got: %d" , size , len (f .buf )))
1876+ panic (fmt .Errorf ("gocql: not enough bytes in buffer to read inet require %d got: %d" , size , len (f .buf )))
18771877 }
18781878
18791879 ip := make ([]byte , size )
0 commit comments