Visitar URL original
fix: Added Online Store REST client errors handler by tmihalac · Pull Request #4488 · feast-dev/feast · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions sdk/python/feast/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __init__(self, name, project=None):


class RequestDataNotFoundInEntityDfException(FeastObjectNotFoundException):
Comment thread
tmihalac marked this conversation as resolved.
def __init__(self, feature_name, feature_view_name):
def __init__(self, feature_name, feature_view_name=None):
super().__init__(
f"Feature {feature_name} not found in the entity dataframe, but required by feature view {feature_view_name}"
)
Expand Down Expand Up @@ -165,12 +165,12 @@ def __init__(self, bucket):


class SavedDatasetNotFound(FeastObjectNotFoundException):
def __init__(self, name: str, project: str):
def __init__(self, name: str, project: str = ""):
super().__init__(f"Saved dataset {name} does not exist in project {project}")


class ValidationReferenceNotFound(FeastObjectNotFoundException):
def __init__(self, name: str, project: str):
def __init__(self, name: str, project: str = ""):
super().__init__(
f"Validation reference {name} does not exist in project {project}"
)
Expand Down Expand Up @@ -205,21 +205,21 @@ def __init__(self, registry_type: str):


class FeastModuleImportError(FeastError):
def __init__(self, module_name: str, class_name: str):
def __init__(self, module_name: str, class_name: str = ""):
super().__init__(
f"Could not import module '{module_name}' while attempting to load class '{class_name}'"
)


class FeastClassImportError(FeastError):
def __init__(self, module_name: str, class_name: str):
def __init__(self, module_name: str, class_name: str = ""):
super().__init__(
f"Could not import class '{class_name}' from module '{module_name}'"
)


class FeastExtrasDependencyImportError(FeastError):
def __init__(self, extras_type: str, nested_error: str):
def __init__(self, extras_type: str, nested_error: str = ""):
message = (
nested_error
+ "\n"
Expand All @@ -229,14 +229,16 @@ def __init__(self, extras_type: str, nested_error: str):


class FeastOfflineStoreUnsupportedDataSource(FeastError):
def __init__(self, offline_store_name: str, data_source_name: str):
def __init__(self, offline_store_name: str, data_source_name: str = ""):
super().__init__(
f"Offline Store '{offline_store_name}' does not support data source '{data_source_name}'"
)


class FeatureNameCollisionError(FeastError):
def __init__(self, feature_refs_collisions: List[str], full_feature_names: bool):
def __init__(
self, feature_refs_collisions: List[str], full_feature_names: bool = False
):
if full_feature_names:
collisions = [ref.replace(":", "__") for ref in feature_refs_collisions]
error_message = (
Expand All @@ -261,8 +263,8 @@ class SpecifiedFeaturesNotPresentError(FeastError):
def __init__(
self,
specified_features: List[Field],
inferred_features: List[Field],
feature_view_name: str,
inferred_features: List[Field] = [],
feature_view_name: str = "",
):
super().__init__(
f"Explicitly specified features {specified_features} not found in inferred list of features "
Expand Down Expand Up @@ -297,21 +299,21 @@ def __init__(self, auth_config_class_name: str):


class FeastInvalidBaseClass(FeastError):
def __init__(self, class_name: str, class_type: str):
def __init__(self, class_name: str, class_type: str = ""):
super().__init__(
f"Class '{class_name}' should have `{class_type}` as a base class."
)


class FeastOnlineStoreUnsupportedDataSource(FeastError):
def __init__(self, online_store_name: str, data_source_name: str):
def __init__(self, online_store_name: str, data_source_name: str = ""):
super().__init__(
f"Online Store '{online_store_name}' does not support data source '{data_source_name}'"
)


class FeastEntityDFMissingColumnsError(FeastError):
def __init__(self, expected, missing):
def __init__(self, expected, missing=None):
super().__init__(
f"The entity dataframe you have provided must contain columns {expected}, "
f"but {missing} were missing."
Expand All @@ -320,7 +322,10 @@ def __init__(self, expected, missing):

class FeastJoinKeysDuringMaterialization(FeastError):
def __init__(
self, source: str, join_key_columns: Set[str], source_columns: Set[str]
self,
source: str,
join_key_columns: Set[str] = set(),
source_columns: Set[str] = set(),
):
super().__init__(
f"The DataFrame from {source} being materialized must have at least {join_key_columns} columns present, "
Expand All @@ -337,7 +342,7 @@ def __init__(self):


class RegistryInferenceFailure(FeastError):
def __init__(self, repo_obj_type: str, specific_issue: str):
def __init__(self, repo_obj_type: str, specific_issue: str = ""):
super().__init__(
f"Inference to fill in missing information for {repo_obj_type} failed. {specific_issue}. "
"Try filling the information explicitly."
Expand Down Expand Up @@ -389,7 +394,7 @@ def __init__(self, expected_column_name: str):


class FeatureViewMissingDuringFeatureServiceInference(FeastError):
def __init__(self, feature_view_name: str, feature_service_name: str):
def __init__(self, feature_view_name: str, feature_service_name: str = ""):
super().__init__(
f"Missing {feature_view_name} feature view during inference for {feature_service_name} feature service."
)
Expand Down Expand Up @@ -451,6 +456,9 @@ class PushSourceNotFoundException(FeastError):
def __init__(self, push_source_name: str):
super().__init__(f"Unable to find push source '{push_source_name}'.")

def http_status_code(self) -> int:
return HttpStatusCode.HTTP_422_UNPROCESSABLE_ENTITY


class ReadOnlyRegistryException(FeastError):
def __init__(self):
Expand All @@ -465,7 +473,7 @@ def __init__(self, input_dict: dict):


class PermissionNotFoundException(FeastError):
def __init__(self, name, project):
def __init__(self, name, project=None):
super().__init__(f"Permission {name} does not exist in project {project}")


Expand Down
Loading