Skip to content

Commit

Permalink
Clarify error using add_if_missing on ownerless asset (stac-utils#746)
Browse files Browse the repository at this point in the history
* Clarify error using add_if_missing on ownerless asset

* Add CHANGELOG entry for stac-utils#746
  • Loading branch information
duckontheweb authored Feb 22, 2022
1 parent 94eb97c commit 1a1ff77
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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))
- Type errors when initializing `TemporalExtent` using a list of `datetime` objects ([#744](https://github.com/stac-utils/pystac/pull/744))

### Deprecated
Expand Down
3 changes: 2 additions & 1 deletion pystac/extensions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1a1ff77

Please sign in to comment.