Skip to content

Commit

Permalink
Allow any type of value for missing value
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarans committed Jan 10, 2025
1 parent 6ceca7a commit 212e95d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/hdx/utilities/error_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@ def add(
dict_of_sets_add(self.shared_errors[message_type], category, output)

@staticmethod
def missing_value_message(value_type: str, value: str) -> str:
def missing_value_message(value_type: str, value: Any) -> str:
"""
Generate a formatted message for a missing value of a specific type in
a fixed format:
error category - type n not found
Args:
value_type (str): The type of value that is missing
value (str): The specific missing value
value (Any): The specific missing value
Returns:
str: A formatted message stating the missing value and its type
"""
return f"{value_type} {value} not found"
return f"{value_type} {str(value)} not found"

def add_missing_value(
self,
value_type: str,
value: str,
value: Any,
category: str = "",
message_type: str = "error",
) -> None:
Expand All @@ -83,7 +83,7 @@ def add_missing_value(
identifier is usually a dataset name.
Args:
value_type (str): Type of value e.g. "sector"
value (str): Missing value
value (Any): Missing value
category (str): Error category. Defaults to "".
message_type (str): The type of message (error or warning). Default is "error"
Returns:
Expand Down

0 comments on commit 212e95d

Please sign in to comment.