From 5395641c18145d3a886ab190cb947fbb95c2b006 Mon Sep 17 00:00:00 2001 From: Jon Duckworth Date: Tue, 8 Feb 2022 09:54:54 -0500 Subject: [PATCH 1/2] Clarify error using add_if_missing on ownerless asset --- pystac/extensions/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pystac/extensions/base.py b/pystac/extensions/base.py index 9c950e9e6..28ae84227 100644 --- a/pystac/extensions/base.py +++ b/pystac/extensions/base.py @@ -151,7 +151,8 @@ def validate_owner_has_extension( if asset.owner is None: if add_if_missing: raise pystac.STACError( - "Can only add schema URIs to Assets with an owner." + "Attempted to use add_if_missing=True for an Asset with no owner. " + "Use Asset.set_owner or set add_if_missing=False." ) else: return From 894ba2e6d2d14ffdb38868674a6130ae0f647f69 Mon Sep 17 00:00:00 2001 From: Jon Duckworth Date: Tue, 8 Feb 2022 09:59:10 -0500 Subject: [PATCH 2/2] Add CHANGELOG entry for #746 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b533a79..7023097bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ - Self links no longer included in Items for "relative published" catalogs ([#725](https://github.com/stac-utils/pystac/pull/725)) - Adding New and Custom Extensions tutorial now up-to-date with new extensions API ([#724](https://github.com/stac-utils/pystac/pull/724)) +- Clarify error message when using `PropertyExtension.ext(..., add_if_missing=True)` on an `Asset` + with no owner([#746](https://github.com/stac-utils/pystac/pull/746)) ### Deprecated