Skip to content
Snippets Groups Projects
Commit 06c9c871 authored by akiraohgaki's avatar akiraohgaki
Browse files

Show exception message

parent 477470db
No related branches found
No related tags found
No related merge requests found
...@@ -260,21 +260,16 @@ class XdgUrl: ...@@ -260,21 +260,16 @@ class XdgUrl:
print('Done') print('Done')
def execute(self): def execute(self):
try: if (self.meta['command'] in ['download', 'install']
if (self.meta['command'] in ['download', 'install'] and self.meta['url']
and self.meta['url'] and self.meta['type'] in self.destinations
and self.meta['type'] in self.destinations and self.meta['filename']):
and self.meta['filename']): if self.meta['command'] == 'download':
if self.meta['command'] == 'download': self.download()
self.download() elif self.meta['command'] == 'install':
elif self.meta['command'] == 'install': self.install()
self.install() else:
return True raise Exception('Incorrect XDG-URL ' + self.xdg_url)
print('Incorrect XDG-URL ' + self.xdg_url)
return False
except:
print('Execution error')
return False
''' '''
class XdgUrlApp(Tkinter.Frame): class XdgUrlApp(Tkinter.Frame):
...@@ -333,10 +328,17 @@ if __name__ == '__main__': ...@@ -333,10 +328,17 @@ if __name__ == '__main__':
window.withdraw() window.withdraw()
if tkMessageBox.askyesno('xdgurl', info_text + '\n\nDo you want to continue?'): if tkMessageBox.askyesno('xdgurl', info_text + '\n\nDo you want to continue?'):
if core.execute(): try:
tkMessageBox.showinfo('xdgurl', info_text + '\n\n' + execute_text + ' finished') core.execute();
except Exception as e:
message = ''
if e.message:
message = e.message
else:
message = str(e)
tkMessageBox.showerror('xdgurl', info_text + '\n\n' + execute_text + ' failed\n' + message)
else: else:
tkMessageBox.showerror('xdgurl', info_text + '\n\n' + execute_text + ' failed') tkMessageBox.showinfo('xdgurl', info_text + '\n\n' + execute_text + ' finished')
sys.exit() sys.exit()
else: else:
print('xdgurl "XDG-URL"') print('xdgurl "XDG-URL"')
......
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