@@ -238,10 +238,13 @@ impl CostModelStorageLayer for BackendManager {
238238                        match  res { 
239239                            Ok ( insert_res)  => insert_res. last_insert_id , 
240240                            Err ( _)  => { 
241-                                 return  Err ( BackendError :: BackendError ( format ! ( 
242-                                     "failed to insert statistic {:?} into statistic table" , 
243-                                     stat
244-                                 ) ) ) 
241+                                 return  Err ( BackendError :: CostModel ( 
242+                                     format ! ( 
243+                                         "failed to insert statistic {:?} into statistic table" , 
244+                                         stat
245+                                     ) 
246+                                     . into ( ) , 
247+                                 ) ) 
245248                            } 
246249                        } 
247250                    } 
@@ -450,10 +453,13 @@ impl CostModelStorageLayer for BackendManager {
450453            . collect :: < Vec < _ > > ( ) ; 
451454
452455        if  attr_ids. len ( )  != attr_base_indices. len ( )  { 
453-             return  Err ( BackendError :: BackendError ( format ! ( 
454-                 "Not all attributes found for table_id {} and base indices {:?}" , 
455-                 table_id,  attr_base_indices
456-             ) ) ) ; 
456+             return  Err ( BackendError :: CostModel ( 
457+                 format ! ( 
458+                     "Not all attributes found for table_id {} and base indices {:?}" , 
459+                     table_id,  attr_base_indices
460+                 ) 
461+                 . into ( ) , 
462+             ) ) ; 
457463        } 
458464
459465        self . get_stats_for_attr ( attr_ids,  stat_type,  epoch_id) . await 
@@ -505,10 +511,13 @@ impl CostModelStorageLayer for BackendManager {
505511            . one ( & self . db ) 
506512            . await ?; 
507513        if  expr_exists. is_none ( )  { 
508-             return  Err ( BackendError :: BackendError ( format ! ( 
509-                 "physical expression id {} not found when storing cost" , 
510-                 physical_expression_id
511-             ) ) ) ; 
514+             return  Err ( BackendError :: CostModel ( 
515+                 format ! ( 
516+                     "physical expression id {} not found when storing cost" , 
517+                     physical_expression_id
518+                 ) 
519+                 . into ( ) , 
520+             ) ) ; 
512521        } 
513522
514523        // Check if epoch_id exists in Event table 
@@ -518,10 +527,9 @@ impl CostModelStorageLayer for BackendManager {
518527            . await 
519528            . unwrap ( ) ; 
520529        if  epoch_exists. is_none ( )  { 
521-             return  Err ( BackendError :: BackendError ( format ! ( 
522-                 "epoch id {} not found when storing cost" , 
523-                 epoch_id
524-             ) ) ) ; 
530+             return  Err ( BackendError :: CostModel ( 
531+                 format ! ( "epoch id {} not found when storing cost" ,  epoch_id) . into ( ) , 
532+             ) ) ; 
525533        } 
526534
527535        let  new_cost = plan_cost:: ActiveModel  { 
0 commit comments