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

Better error handling of missing files #10

Closed
Firstyear opened this Issue Apr 20, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@Firstyear
Collaborator

Firstyear commented Apr 20, 2012

[root@tollgate system]# python /usr/sbin/tollgate_backend
Loading configuration: /etc/tollgate/backend.ini
Setting configuration values...
Traceback (most recent call last):
File "/usr/sbin/tollgate_backend", line 9, in
load_entry_point('tollgate==2.8.4-dev', 'console_scripts', 'tollgate_backend')()
File "/usr/lib/python2.7/site-packages/tollgate-2.8.4_dev-py2.7.egg/tollgate/backend/tollgate_backend.py", line 155, in main_optparse
main(*a)
File "/usr/lib/python2.7/site-packages/tollgate-2.8.4_dev-py2.7.egg/tollgate/backend/tollgate_backend.py", line 86, in main
iptables.IPTABLES = config.get('tollgate', 'iptables')
File "/usr/lib/python2.7/site-packages/configparser_plus.py", line 63, in get
return self._get_with_default(section, option, 'get')
File "/usr/lib/python2.7/site-packages/configparser_plus.py", line 48, in _get_with_default
return getattr(SafeConfigParser, method)(self, section, option)
File "/usr/lib64/python2.7/ConfigParser.py", line 599, in get
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'tollgate'

Should reveal to the user that "No file exists at /etc/tollgate/backend.ini" rather than a stack trace.

micolous added a commit to LanConnect/tollgate that referenced this issue Apr 20, 2012

@micolous

This comment has been minimized.

Owner

micolous commented Apr 20, 2012

Fixed.

Loading configuration: /etc/tollgate/backend.ini
Failure reading configuration file!
 failed!

@micolous micolous closed this Apr 20, 2012

@ghost ghost assigned micolous Apr 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment