Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sys.exit(1) on failures #384

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sven-oly
Copy link
Collaborator

No description provided.

@@ -126,7 +126,8 @@ def main(args):
len(schema_errors), schema_count)
for failure in schema_errors:
logging.error(' %s', failure)
exit(1)
# We need to clobber the process
sys.exit(1)
else:
logging.info("All %d schema are valid in file %s", schema_count, output_filename)
exit(0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You didn't change this line. But I wonder if you need it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think sys.exit is appropriate here.

else:
logging.info("All %d generated test data files match with schema", schema_count)
exit(0)
sys.exit(0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need a sys.exit(0)? If this is the last line of the happy case, then it reads better to remove the line. When I see sys.exit(<nonzero>), I assume that someone is signalling an unnaturally early exit, so a really unhappy case. Happy cases and handled unhappy cases would otherwise be treated "normally" (no op, try/catch exception handling, etc.).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants