catch get exception in cfgfile, not in other places
This commit is contained in:
@@ -11,7 +11,6 @@ import configparser
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
class Conf(object):
|
||||
confobj = configparser.RawConfigParser()
|
||||
cfgfile = ''
|
||||
@@ -57,7 +56,10 @@ class Conf(object):
|
||||
"""
|
||||
if not self.cfgfile:
|
||||
raise Exception('No config file set')
|
||||
return self.confobj.get(section, option)
|
||||
try:
|
||||
return self.confobj.get(section, option)
|
||||
except configparser.NoOptionError:
|
||||
raise ValueError('Option does not exist')
|
||||
|
||||
def set(self, section, option, value):
|
||||
"""docstring for update"""
|
||||
|
Reference in New Issue
Block a user