Skip to content

Commit

Permalink
Enhance error check in setting.ini and profile.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
deepjia committed Jul 25, 2018
1 parent e1994a8 commit f366b55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions v2config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ def optionxform(self, optionstr):
try:
self.config.read(file, encoding='UTF-8')
except Exception as e:
QMessageBox.critical(QWidget(), 'Read Error', str(e))
QMessageBox.critical(QWidget(), 'Critical', repr(e))
subprocess.run(["open", file])
sys.exit(1)

def get_items(self, section):
try:
return self.config[section].items()
except KeyError as e:
QMessageBox.critical(QWidget(), 'Key Error', 'Key Error: ' + str(e) + ' in file: ' + self.file)
except Exception as e:
QMessageBox.critical(QWidget(), 'Critical', repr(e) + ' in file: ' + self.file)
subprocess.run(["open", self.file])
sys.exit(1)

Expand Down
2 changes: 1 addition & 1 deletion v2net.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

# Global vars
selected = {x: SETTING.get('Global', x) for x in ('proxy', 'bypass', 'capture')}
system = True if SETTING.get('Global', 'system', 'false').strip().lower() == 'true' else False
system = SETTING.get('Global', 'system', 'false').strip().lower() == 'true'
http_port = ''
socks5_port = ''
current = {x: None for x in ('proxy', 'bypass', 'capture')}
Expand Down

0 comments on commit f366b55

Please sign in to comment.