@@ -5,10 +5,10 @@ use crate::{
5
5
blockchain:: { block_stream:: FirehoseCursor , BlockPtr , BlockTime } ,
6
6
cheap_clone:: CheapClone ,
7
7
components:: subgraph:: Entity ,
8
- constraint_violation,
9
8
data:: { store:: Id , subgraph:: schema:: SubgraphError } ,
10
9
data_source:: CausalityRegion ,
11
10
derive:: CacheWeight ,
11
+ internal_error,
12
12
util:: cache_weight:: CacheWeight ,
13
13
} ;
14
14
@@ -182,7 +182,7 @@ impl EntityModification {
182
182
match self {
183
183
Insert { end, .. } | Overwrite { end, .. } => {
184
184
if end. is_some ( ) {
185
- return Err ( constraint_violation ! (
185
+ return Err ( internal_error ! (
186
186
"can not clamp {:?} to block {}" ,
187
187
self ,
188
188
block
@@ -191,7 +191,7 @@ impl EntityModification {
191
191
* end = Some ( block) ;
192
192
}
193
193
Remove { .. } => {
194
- return Err ( constraint_violation ! (
194
+ return Err ( internal_error ! (
195
195
"can not clamp block range for removal of {:?} to {}" ,
196
196
self ,
197
197
block
@@ -219,7 +219,7 @@ impl EntityModification {
219
219
end,
220
220
} ) ,
221
221
Remove { key, .. } => {
222
- return Err ( constraint_violation ! (
222
+ return Err ( internal_error ! (
223
223
"a remove for {}[{}] can not be converted into an insert" ,
224
224
entity_type,
225
225
key. entity_id
@@ -330,7 +330,7 @@ impl RowGroup {
330
330
if !is_forward {
331
331
// unwrap: we only get here when `last()` is `Some`
332
332
let last_block = self . rows . last ( ) . map ( |emod| emod. block ( ) ) . unwrap ( ) ;
333
- return Err ( constraint_violation ! (
333
+ return Err ( internal_error ! (
334
334
"we already have a modification for block {}, can not append {:?}" ,
335
335
last_block,
336
336
emod
@@ -412,7 +412,7 @@ impl RowGroup {
412
412
self . rows . push ( row) ;
413
413
}
414
414
EntityModification :: Overwrite { .. } | EntityModification :: Remove { .. } => {
415
- return Err ( constraint_violation ! (
415
+ return Err ( internal_error ! (
416
416
"immutable entity type {} only allows inserts, not {:?}" ,
417
417
self . entity_type,
418
418
row
@@ -426,7 +426,7 @@ impl RowGroup {
426
426
use EntityModification :: * ;
427
427
428
428
if row. block ( ) <= prev_row. block ( ) {
429
- return Err ( constraint_violation ! (
429
+ return Err ( internal_error ! (
430
430
"can not append operations that go backwards from {:?} to {:?}" ,
431
431
prev_row,
432
432
row
@@ -444,7 +444,7 @@ impl RowGroup {
444
444
Insert { end : Some ( _) , .. } | Overwrite { end : Some ( _) , .. } ,
445
445
Overwrite { .. } | Remove { .. } ,
446
446
) => {
447
- return Err ( constraint_violation ! (
447
+ return Err ( internal_error ! (
448
448
"impossible combination of entity operations: {:?} and then {:?}" ,
449
449
prev_row,
450
450
row
@@ -481,7 +481,7 @@ impl RowGroup {
481
481
482
482
fn append ( & mut self , group : RowGroup ) -> Result < ( ) , StoreError > {
483
483
if self . entity_type != group. entity_type {
484
- return Err ( constraint_violation ! (
484
+ return Err ( internal_error ! (
485
485
"Can not append a row group for {} to a row group for {}" ,
486
486
group. entity_type,
487
487
self . entity_type
@@ -710,7 +710,7 @@ impl Batch {
710
710
711
711
fn append_inner ( & mut self , mut batch : Batch ) -> Result < ( ) , StoreError > {
712
712
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) ) ;
714
714
}
715
715
716
716
self . block_ptr = batch. block_ptr ;
0 commit comments