@@ -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,10 @@ impl CostModelStorageLayer for BackendManager {
450453 . collect :: < Vec < _ > > ( ) ;
451454
452455 if attr_ids. len ( ) != attr_base_indices. len ( ) {
453- return Err ( BackendError :: BackendError ( format ! (
456+ return Err ( BackendError :: CostModel ( format ! (
454457 "Not all attributes found for table_id {} and base indices {:?}" ,
455458 table_id, attr_base_indices
456- ) ) ) ;
459+ ) . into ( ) ) ) ;
457460 }
458461
459462 self . get_stats_for_attr ( attr_ids, stat_type, epoch_id) . await
@@ -505,10 +508,10 @@ impl CostModelStorageLayer for BackendManager {
505508 . one ( & self . db )
506509 . await ?;
507510 if expr_exists. is_none ( ) {
508- return Err ( BackendError :: BackendError ( format ! (
511+ return Err ( BackendError :: CostModel ( format ! (
509512 "physical expression id {} not found when storing cost" ,
510513 physical_expression_id
511- ) ) ) ;
514+ ) . into ( ) ) ) ;
512515 }
513516
514517 // Check if epoch_id exists in Event table
@@ -518,10 +521,10 @@ impl CostModelStorageLayer for BackendManager {
518521 . await
519522 . unwrap ( ) ;
520523 if epoch_exists. is_none ( ) {
521- return Err ( BackendError :: BackendError ( format ! (
524+ return Err ( BackendError :: CostModel ( format ! (
522525 "epoch id {} not found when storing cost" ,
523526 epoch_id
524- ) ) ) ;
527+ ) . into ( ) ) ) ;
525528 }
526529
527530 let new_cost = plan_cost:: ActiveModel {
0 commit comments