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 a exception flag for print_config_report_error #48

Open
micahjohnson150 opened this issue Mar 12, 2020 · 0 comments
Open

Add a exception flag for print_config_report_error #48

micahjohnson150 opened this issue Mar 12, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@micahjohnson150
Copy link
Collaborator

micahjohnson150 commented Mar 12, 2020

  • inicheck version: 0.7.9
  • Python version: 3.6

Description

Most of the software we use has a line that goes like the following:

 
warnings, errors = check_config(self.ucfg)
print_config_report(warnings, errors)

if len(errors) > 0:
   self.log.error("Error in config file. Check report above.")
   sys.exit() # Or raises an exception

A nice recommendation by @scotthavens is to add the latter part to print_conifg_report and enable it with a flag to incur an exception in the event errors are which would then look like for the end use:

 
warnings, errors = check_config(self.ucfg)
print_config_report(warnings, errors, exception_on_errors=True)
@micahjohnson150 micahjohnson150 added the enhancement New feature or request label Mar 12, 2020
@micahjohnson150 micahjohnson150 self-assigned this Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant