diff --git a/bluemira/structural/element.py b/bluemira/structural/element.py index d6da562eee..6fa1aab193 100644 --- a/bluemira/structural/element.py +++ b/bluemira/structural/element.py @@ -42,13 +42,13 @@ class LoadType(Enum): NODE_LOAD = auto() @classmethod - def _missing_(cls, value): + def _missing_(cls, value: str): try: return cls[value.replace(" ", "_").upper()] except KeyError: raise StructuralError( - f"Invalid load: {value}. Choose from:" - f"element_load, distributed_load, node_load" + f"{cls.__name__} has no load type {value}" + f"please select from {*cls._member_names_, }" ) from None diff --git a/bluemira/structural/loads.py b/bluemira/structural/loads.py index 2a4f002478..b25062e405 100644 --- a/bluemira/structural/loads.py +++ b/bluemira/structural/loads.py @@ -25,12 +25,13 @@ class SubLoadType(Enum): ALL = auto() @classmethod - def _missing_(cls, value): + def _missing_(cls, value: str): try: return cls[value.upper()] except KeyError: raise StructuralError( - f"Unknown SubLoad type {value}. Choose from: force, moment or all" + f"{cls.__name__} has no load type {value}" + f"please select from {*cls._member_names_, }" ) from None