diff --git a/pystac/extensions/pointcloud.py b/pystac/extensions/pointcloud.py index 67fb62e..fb1d3e6 100644 --- a/pystac/extensions/pointcloud.py +++ b/pystac/extensions/pointcloud.py @@ -14,6 +14,7 @@ from pystac.extensions.base import ( from pystac.extensions.hooks import ExtensionHooks from pystac.summaries import RangeSummary from pystac.utils import map_opt, get_required +from pystac.errors import RequiredPropertyMissing T = TypeVar("T", pystac.Item, pystac.Asset) @@ -90,9 +91,7 @@ class Schema: """Gets or sets the size value.""" result: Optional[int] = self.properties.get("size") if result is None: - raise pystac.STACError( - f"Pointcloud schema does not have size property: {self.properties}" - ) + raise RequiredPropertyMissing(self, "size") return result @size.setter @@ -107,9 +106,7 @@ class Schema: """Gets or sets the name property for this Schema.""" result: Optional[str] = self.properties.get("name") if result is None: - raise pystac.STACError( - f"Pointcloud schema does not have name property: {self.properties}" - ) + raise RequiredPropertyMissing(self, "name") return result @name.setter @@ -127,9 +124,10 @@ class Schema: self.properties["type"] = v def __repr__(self) -> str: - return "".format( - self.name, self.size, self.type - ) + name = self.properties.get("name", "") + size = self.properties.get("size", "") + typ = self.properties.get("type", "") + return f"" def to_dict(self) -> Dict[str, Any]: """Returns a JSON-like dictionary representing this ``Schema``.""" @@ -219,9 +217,7 @@ class Statistic: """Gets or sets the name property.""" result: Optional[str] = self.properties.get("name") if result is None: - raise pystac.STACError( - f"Pointcloud statistics does not have name property: {self.properties}" - ) + raise RequiredPropertyMissing(self, "name") return result @name.setter