Skip to content

Commit c3685d4

Browse files
authored
Merge pull request #244 from schwehr/cat-type-checking
catalog.py: Be more strict with CatalogType in save()
2 parents 4116383 + d2a20b9 commit c3685d4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pystac/catalog.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,10 @@ def save(self, catalog_type=None):
594594
# Ensure relative vs absolute
595595
if catalog_type == CatalogType.ABSOLUTE_PUBLISHED:
596596
self.make_all_links_absolute()
597-
else:
597+
elif catalog_type in (CatalogType.SELF_CONTAINED, CatalogType.RELATIVE_PUBLISHED):
598598
self.make_all_links_relative()
599+
else:
600+
raise ValueError(f'catalog_type is not a CatalogType: "{catalog_type}"')
599601

600602
include_self_link = catalog_type in [
601603
CatalogType.ABSOLUTE_PUBLISHED, CatalogType.RELATIVE_PUBLISHED

0 commit comments

Comments
 (0)