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

Exit with status code 1 on error #15

Merged
merged 2 commits into from
Jul 3, 2022

Conversation

chrsm
Copy link
Contributor

@chrsm chrsm commented Jun 29, 2022

This addresses the issue my colleague reported here.

I think I caught all the appropriate cases (rather than just this specific one). Not sure if this is inline with how you'd prefer it to be implemented, happy to make adjustments.

Copy link
Owner

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

Thanks for opening a fix for this and for addressing it for all the other error cases that weren't being captured in the exit status.

I'd be inclined to return the errors from the function, then capture the error in the main function, so that the main function is small and all other code is just passing errors.

What do you think?

@chrsm
Copy link
Contributor Author

chrsm commented Jun 30, 2022

Hi @leighmcculloch no problem!

Since these changes are in main, are you suggesting some refactoring to move the indexing/writing into separate functions that just return errors? I can handle that.

@leighmcculloch
Copy link
Owner

Yup. The refactor is quite minor, just renaming main to something else like run that returns an error, and in main if error exit 1 as you did in the helper function.

@chrsm chrsm force-pushed the chrsm/14-exit1-on-error branch from 546c2b4 to b682a84 Compare July 3, 2022 04:05
@chrsm
Copy link
Contributor Author

chrsm commented Jul 3, 2022

@leighmcculloch updated, let me know what you think! Sorry for the delay, I have been 😷

@leighmcculloch leighmcculloch merged commit 89c43c7 into leighmcculloch:master Jul 3, 2022
@leighmcculloch
Copy link
Owner

@chrsm Looks great!!! Thanks!!!

@leighmcculloch leighmcculloch linked an issue Jul 3, 2022 that may be closed by this pull request
@leighmcculloch leighmcculloch added this to the v1.3.0 milestone Jul 3, 2022
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.

Vangen exits with status 0 when there is a syntax error
2 participants