File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313- Support for fetching catalog queryables [ #477 ] ( https://github.com/stac-utils/pystac-client/pull/477 )
1414- PySTAC Client specific warnings [ #480 ] ( https://github.com/stac-utils/pystac-client/pull/480 )
1515- Support for fetching and merging a selection of queryables [ #511 ] ( https://github.com/stac-utils/pystac-client/pull/511 )
16+ - Better error messages for the CLI [ #531 ] ( https://github.com/stac-utils/pystac-client/pull/531 )
1617
1718### Changed
1819
Original file line number Diff line number Diff line change 77import warnings
88from typing import Any , Dict , List , Optional
99
10+ from pystac import STACTypeError
11+
1012from .client import Client
1113from .conformance import ConformanceClasses
1214from .item_search import OPS
@@ -50,7 +52,7 @@ def search(
5052 return 0
5153
5254 except Exception as e :
53- print (e )
55+ print (f"ERROR: { e } " )
5456 return 1
5557
5658
@@ -64,8 +66,15 @@ def collections(client: Client, save: Optional[str] = None) -> int:
6466 else :
6567 print (json .dumps (collections_dicts ))
6668 return 0
69+ except STACTypeError as e :
70+ print (f"ERROR: { e } " )
71+ print (
72+ f"The client at { client .self_href } is OK, but one or more of the "
73+ "collections is invalid."
74+ )
75+ return 1
6776 except Exception as e :
68- print (e )
77+ print (f"ERROR: { e } " )
6978 return 1
7079
7180
@@ -329,7 +338,7 @@ def cli() -> int:
329338 )
330339
331340 except Exception as e :
332- print (e , file = sys .stderr )
341+ print (f"ERROR: { e } " , file = sys .stderr )
333342 return 1
334343
335344 if cmd == "search" :
You can’t perform that action at this time.
0 commit comments