Skip to content
Snippets Groups Projects
Commit cdf6e034 authored by dkirov's avatar dkirov
Browse files

when IOError occurs during saving preferences

now print os.strerror of the error code
parent 07fecda4
No related branches found
No related tags found
No related merge requests found
......@@ -79,14 +79,8 @@ class OptionsParser:
try:
gajim.config.foreach(self.write_line, fd)
except IOError, e:
print e, dir(e), e.errno
if e.errno == 28:
err_str = _('No space left on device')
else:
err_str = e
print err_str
fd.close()
return err_str
return e.errno
fd.close()
if os.path.exists(self.__filename):
# win32 needs this
......@@ -96,8 +90,7 @@ class OptionsParser:
pass
try:
os.rename(self.__tempfile, self.__filename)
except:
err_str = _('Unable to open %s for writing\n') % (self.__filename)
return err_str
except IOError, e:
return e.errno
return None
......@@ -1020,11 +1020,12 @@ class Interface:
return False
def save_config(self):
err_str = parser.write()
if err_str is not None:
dialogs.ErrorDialog(_('Cannot save your preferences'),
err_str).get_response()
sys.exit(2)
err_code = parser.write()
if err_code is not None:
os.strerror(err_code)
# it is good to notify the user, in case he cannot see the output of the console
dialogs.ErrorDialog(_('Cannot save your preferences')).get_response()
sys.exit(1)
def enable_dbus(self):
if 'remote_control' not in globals():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment