2121from feast .errors import (
2222 FeastFeatureServerTypeInvalidError ,
2323 FeastFeatureServerTypeSetError ,
24+ FeastOfflineStoreInvalidName ,
25+ FeastOnlineStoreInvalidName ,
2426 FeastProviderNotSetError ,
2527)
2628from feast .importer import import_class
@@ -278,7 +280,8 @@ def _validate_online_store_config(cls, values):
278280 return values
279281
280282 # Make sure that the provider configuration is set. We need it to set the defaults
281- assert "provider" in values
283+ if "provider" not in values :
284+ raise FeastProviderNotSetError ()
282285
283286 # Set the default type
284287 # This is only direct reference to a provider or online store that we should have
@@ -315,7 +318,8 @@ def _validate_offline_store_config(cls, values):
315318 return values
316319
317320 # Make sure that the provider configuration is set. We need it to set the defaults
318- assert "provider" in values
321+ if "provider" not in values :
322+ raise FeastProviderNotSetError ()
319323
320324 # Set the default type
321325 if "type" not in values ["offline_store" ]:
@@ -455,8 +459,8 @@ def get_batch_engine_config_from_type(batch_engine_type: str):
455459def get_online_config_from_type (online_store_type : str ):
456460 if online_store_type in ONLINE_STORE_CLASS_FOR_TYPE :
457461 online_store_type = ONLINE_STORE_CLASS_FOR_TYPE [online_store_type ]
458- else :
459- assert online_store_type . endswith ( "OnlineStore" )
462+ elif not online_store_type . endswith ( "OnlineStore" ) :
463+ raise FeastOnlineStoreInvalidName ( online_store_type )
460464 module_name , online_store_class_type = online_store_type .rsplit ("." , 1 )
461465 config_class_name = f"{ online_store_class_type } Config"
462466
@@ -466,8 +470,8 @@ def get_online_config_from_type(online_store_type: str):
466470def get_offline_config_from_type (offline_store_type : str ):
467471 if offline_store_type in OFFLINE_STORE_CLASS_FOR_TYPE :
468472 offline_store_type = OFFLINE_STORE_CLASS_FOR_TYPE [offline_store_type ]
469- else :
470- assert offline_store_type . endswith ( "OfflineStore" )
473+ elif not offline_store_type . endswith ( "OfflineStore" ) :
474+ raise FeastOfflineStoreInvalidName ( offline_store_type )
471475 module_name , offline_store_class_type = offline_store_type .rsplit ("." , 1 )
472476 config_class_name = f"{ offline_store_class_type } Config"
473477
0 commit comments