Skip to content

Commit 3f5a441

Browse files
committed
improve argument and error handling
1 parent f05b713 commit 3f5a441

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/1-fetch/gcs_fetch.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ def parse_arguments():
8282
action="store_true",
8383
help="Development mode: avoid hitting API (generate fake data)",
8484
)
85-
return parser.parse_args()
85+
args = parser.parse_args()
86+
if not args.enable_save and args.enable_git:
87+
parser.error("--enable-git requires --enable-save")
88+
return args
8689

8790

8891
def get_search_service():
@@ -289,7 +292,8 @@ def main():
289292
LOGGER.error(e.message)
290293
sys.exit(e.exit_code)
291294
except SystemExit as e:
292-
LOGGER.error(f"System exit with code: {e.code}")
295+
if e.code != 0:
296+
LOGGER.error(f"System exit with code: {e.code}")
293297
sys.exit(e.code)
294298
except KeyboardInterrupt:
295299
LOGGER.info("(130) Halted via KeyboardInterrupt.")

0 commit comments

Comments
 (0)