@@ -5,10 +5,10 @@ use crate::{
55 blockchain:: { block_stream:: FirehoseCursor , BlockPtr , BlockTime } ,
66 cheap_clone:: CheapClone ,
77 components:: subgraph:: Entity ,
8- constraint_violation,
98 data:: { store:: Id , subgraph:: schema:: SubgraphError } ,
109 data_source:: CausalityRegion ,
1110 derive:: CacheWeight ,
11+ internal_error,
1212 util:: cache_weight:: CacheWeight ,
1313} ;
1414
@@ -182,7 +182,7 @@ impl EntityModification {
182182 match self {
183183 Insert { end, .. } | Overwrite { end, .. } => {
184184 if end. is_some ( ) {
185- return Err ( constraint_violation ! (
185+ return Err ( internal_error ! (
186186 "can not clamp {:?} to block {}" ,
187187 self ,
188188 block
@@ -191,7 +191,7 @@ impl EntityModification {
191191 * end = Some ( block) ;
192192 }
193193 Remove { .. } => {
194- return Err ( constraint_violation ! (
194+ return Err ( internal_error ! (
195195 "can not clamp block range for removal of {:?} to {}" ,
196196 self ,
197197 block
@@ -219,7 +219,7 @@ impl EntityModification {
219219 end,
220220 } ) ,
221221 Remove { key, .. } => {
222- return Err ( constraint_violation ! (
222+ return Err ( internal_error ! (
223223 "a remove for {}[{}] can not be converted into an insert" ,
224224 entity_type,
225225 key. entity_id
@@ -330,7 +330,7 @@ impl RowGroup {
330330 if !is_forward {
331331 // unwrap: we only get here when `last()` is `Some`
332332 let last_block = self . rows . last ( ) . map ( |emod| emod. block ( ) ) . unwrap ( ) ;
333- return Err ( constraint_violation ! (
333+ return Err ( internal_error ! (
334334 "we already have a modification for block {}, can not append {:?}" ,
335335 last_block,
336336 emod
@@ -412,7 +412,7 @@ impl RowGroup {
412412 self . rows . push ( row) ;
413413 }
414414 EntityModification :: Overwrite { .. } | EntityModification :: Remove { .. } => {
415- return Err ( constraint_violation ! (
415+ return Err ( internal_error ! (
416416 "immutable entity type {} only allows inserts, not {:?}" ,
417417 self . entity_type,
418418 row
@@ -426,7 +426,7 @@ impl RowGroup {
426426 use EntityModification :: * ;
427427
428428 if row. block ( ) <= prev_row. block ( ) {
429- return Err ( constraint_violation ! (
429+ return Err ( internal_error ! (
430430 "can not append operations that go backwards from {:?} to {:?}" ,
431431 prev_row,
432432 row
@@ -444,7 +444,7 @@ impl RowGroup {
444444 Insert { end : Some ( _) , .. } | Overwrite { end : Some ( _) , .. } ,
445445 Overwrite { .. } | Remove { .. } ,
446446 ) => {
447- return Err ( constraint_violation ! (
447+ return Err ( internal_error ! (
448448 "impossible combination of entity operations: {:?} and then {:?}" ,
449449 prev_row,
450450 row
@@ -481,7 +481,7 @@ impl RowGroup {
481481
482482 fn append ( & mut self , group : RowGroup ) -> Result < ( ) , StoreError > {
483483 if self . entity_type != group. entity_type {
484- return Err ( constraint_violation ! (
484+ return Err ( internal_error ! (
485485 "Can not append a row group for {} to a row group for {}" ,
486486 group. entity_type,
487487 self . entity_type
@@ -710,7 +710,7 @@ impl Batch {
710710
711711 fn append_inner ( & mut self , mut batch : Batch ) -> Result < ( ) , StoreError > {
712712 if batch. block_ptr . number <= self . block_ptr . number {
713- return Err ( constraint_violation ! ( "Batches must go forward. Can't append a batch with block pointer {} to one with block pointer {}" , batch. block_ptr, self . block_ptr) ) ;
713+ return Err ( internal_error ! ( "Batches must go forward. Can't append a batch with block pointer {} to one with block pointer {}" , batch. block_ptr, self . block_ptr) ) ;
714714 }
715715
716716 self . block_ptr = batch. block_ptr ;
0 commit comments