Skip to content

Commit 525aa37

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

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/2-process/gcs_process.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ def parse_arguments():
5252
action="store_true",
5353
help="Enable git actions (fetch, merge, add, commit, and push)",
5454
)
55-
return parser.parse_args()
55+
args = parser.parse_args()
56+
if not args.enable_save and args.enable_git:
57+
parser.error("--enable-git requires --enable-save")
58+
return args
5659

5760

5861
# def load_quarter_data(quarter):
@@ -452,8 +455,9 @@ def main():
452455
LOGGER.error(e.message)
453456
sys.exit(e.exit_code)
454457
except SystemExit as e:
455-
LOGGER.error(f"System exit with code: {e.exit_code}")
456-
sys.exit(e.exit_code)
458+
if e.code != 0:
459+
LOGGER.error(f"System exit with code: {e.code}")
460+
sys.exit(e.code)
457461
except KeyboardInterrupt:
458462
LOGGER.info("(130) Halted via KeyboardInterrupt.")
459463
sys.exit(130)

0 commit comments

Comments
 (0)