@@ -577,7 +577,7 @@ func (i *InterleavingIter) Next() *base.InternalKV {
577577// Calling NextPrefix while positioned at a span boundary is prohibited.
578578func (i * InterleavingIter ) NextPrefix (succKey []byte ) * base.InternalKV {
579579 if i .dir == - 1 {
580- panic ("pebble: cannot switch directions with NextPrefix" )
580+ panic (errors . AssertionFailedf ( "pebble: cannot switch directions with NextPrefix" ) )
581581 }
582582
583583 switch i .pos {
@@ -597,7 +597,7 @@ func (i *InterleavingIter) NextPrefix(succKey []byte) *base.InternalKV {
597597 i .computeSmallestPos ()
598598 }
599599 case posKeyspanStart , posKeyspanEnd :
600- panic (errors .AssertionFailedf ("NextPrefix called while positioned on a span boundary" ))
600+ panic (errors .AssertionFailedf ("pebble: NextPrefix called while positioned on a span boundary" ))
601601 }
602602 return i .yieldPosition (i .opts .LowerBound , i .nextPos )
603603}
@@ -756,7 +756,7 @@ func (i *InterleavingIter) nextPos() {
756756 // MIN(pointKey,span.End).
757757 switch {
758758 case i .span == nil :
759- panic (" i.withinSpan=true and i.span=nil" )
759+ panic (errors . AssertionFailedf ( "pebble: i.withinSpan=true and i.span=nil") )
760760 case i .pointKV == nil :
761761 // Since i.withinSpan=true, we step onto the end boundary of the
762762 // keyspan.
@@ -781,7 +781,7 @@ func (i *InterleavingIter) nextPos() {
781781 i .enforceBoundsForward ()
782782 i .computeSmallestPos ()
783783 default :
784- panic (errors .AssertionFailedf ("unexpected pos=%d" , i .pos ))
784+ panic (errors .AssertionFailedf ("pebble: unexpected pos=%d" , i .pos ))
785785 }
786786}
787787
@@ -825,7 +825,7 @@ func (i *InterleavingIter) prevPos() {
825825 }
826826 switch {
827827 case i .span == nil :
828- panic ("withinSpan=true, but i.span == nil" )
828+ panic (errors . AssertionFailedf ( "withinSpan=true, but i.span == nil" ) )
829829 case i .pointKV == nil :
830830 i .pos = posKeyspanStart
831831 default :
@@ -848,7 +848,7 @@ func (i *InterleavingIter) prevPos() {
848848 i .pos = posKeyspanStart
849849 }
850850 default :
851- panic (errors .AssertionFailedf ("unexpected pos=%d" , i .pos ))
851+ panic (errors .AssertionFailedf ("pebble: unexpected pos=%d" , i .pos ))
852852 }
853853}
854854
@@ -866,7 +866,7 @@ func (i *InterleavingIter) yieldPosition(lowerBound []byte, advance func()) *bas
866866 return i .yieldNil ()
867867 case posPointKey :
868868 if i .pointKV == nil {
869- panic (" i.pointKV is nil" )
869+ panic (errors . AssertionFailedf ( "pebble: i.pointKV is nil") )
870870 }
871871
872872 if i .opts .Mask != nil {
@@ -914,7 +914,7 @@ func (i *InterleavingIter) yieldPosition(lowerBound []byte, advance func()) *bas
914914 }
915915 return i .yieldSyntheticSpanStartMarker (lowerBound )
916916 default :
917- panic (errors .AssertionFailedf ("unexpected interleavePos=%d" , i .pos ))
917+ panic (errors .AssertionFailedf ("pebble: unexpected interleavePos=%d" , i .pos ))
918918 }
919919 }
920920}
@@ -1084,17 +1084,22 @@ func (i *InterleavingIter) verify(kv *base.InternalKV) *base.InternalKV {
10841084 if invariants .Enabled {
10851085 switch {
10861086 case i .dir == - 1 && i .spanMarkerTruncated :
1087- panic ("pebble: invariant violation: truncated span key in reverse iteration" )
1087+ panic (errors . AssertionFailedf ( "pebble: invariant violation: truncated span key in reverse iteration" ) )
10881088 case kv != nil && i .opts .LowerBound != nil && ! kv .K .IsExclusiveSentinel () &&
10891089 i .cmp (kv .K .UserKey , i .opts .LowerBound ) < 0 :
1090- panic ("pebble: invariant violation: key < lower bound" )
1090+ panic (errors .AssertionFailedf ("pebble: invariant violation: key (%q) < lower bound (%q)" ,
1091+ kv .K .UserKey , i .opts .LowerBound ))
10911092 case kv != nil && i .opts .UpperBound != nil && ! kv .K .IsExclusiveSentinel () &&
10921093 ! base .UserKeyExclusive (i .opts .UpperBound ).IsUpperBoundForInternalKey (i .comparer .Compare , kv .K ):
1093- panic ("pebble: invariant violation: key ≥ upper bound" )
1094+ panic (errors .AssertionFailedf ("pebble: invariant violation: key (%q) ≥ upper bound (%q)" ,
1095+ kv .K .UserKey , i .opts .UpperBound ))
10941096 case i .err != nil && kv != nil :
1095- panic ("pebble: invariant violation: accumulated error swallowed" )
1097+ panic (errors .WithSecondaryError (errors .AssertionFailedf (
1098+ "pebble: invariant violation: accumulated error swallowed" ), i .err ))
10961099 case i .err == nil && i .pointIter .Error () != nil :
1097- panic ("pebble: invariant violation: pointIter swallowed" )
1100+ panic (errors .WithSecondaryError (
1101+ errors .AssertionFailedf ("pebble: invariant violation: pointIter error swallowed" ),
1102+ i .pointIter .Error ()))
10981103 }
10991104 }
11001105 return kv
@@ -1162,7 +1167,7 @@ func (i *InterleavingIter) savePoint(kv *base.InternalKV) {
11621167// Span will never return an invalid or empty span.
11631168func (i * InterleavingIter ) Span () * Span {
11641169 if invariants .Enabled && i .pointIter == nil {
1165- panic ("Span() called after close" )
1170+ panic (errors . AssertionFailedf ( "Span() called after close" ) )
11661171 }
11671172 if ! i .withinSpan || len (i .span .Keys ) == 0 {
11681173 return nil
0 commit comments