summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-13 21:48:46 +0100
committerhut <hut@lavabit.com>2010-01-13 21:48:46 +0100
commit117028c3337b69f51cc09de2148c7206ee1b96e1 (patch)
tree9270d7479edc1eb9faba1222890ca7d4d8ac26d3
parent698ba46a5a73682a5f9d7832c23683868246841f (diff)
downloadranger-117028c3337b69f51cc09de2148c7206ee1b96e1.tar.gz
Added error handlers for failed commands
-rw-r--r--ranger/gui/ui.py5
-rw-r--r--ranger/gui/widgets/console.py10
-rw-r--r--ranger/gui/widgets/pager.py5
-rw-r--r--ranger/gui/widgets/taskview.py5
4 files changed, 20 insertions, 5 deletions
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 771f0b2a..c7c4a14b 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -138,7 +138,10 @@ class UI(DisplayableContainer):
 			if hasattr(self, 'hint'):
 				self.hint(cmd.text)
 		elif hasattr(cmd, 'execute'):
-			cmd.execute_wrap(self)
+			try:
+				cmd.execute_wrap(self)
+			except Exception as error:
+				self.fm.notify(error)
 			self.env.key_clear()
 
 	def get_next_key(self):
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 90192bee..6cf00b14 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -123,7 +123,10 @@ class Console(Widget):
 		if cmd == self.commandlist.dummy_object:
 			return
 
-		cmd.execute_wrap(self)
+		try:
+			cmd.execute_wrap(self)
+		except Exception as error:
+			self.fm.notify(error)
 		self.env.key_clear()
 
 	def type_key(self, key):
@@ -265,7 +268,10 @@ class CommandConsole(ConsoleWithTab):
 			cmd = self._get_cmd()
 
 		if cmd:
-			cmd.execute()
+			try:
+				cmd.execute()
+			except Exception as error:
+				self.fm.notify(error)
 
 		Console.execute(self)
 
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index c14e0efb..52de9ccf 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -170,7 +170,10 @@ class Pager(Widget):
 			self.env.key_clear()
 		else:
 			if hasattr(cmd, 'execute'):
-				cmd.execute_wrap(self)
+				try:
+					cmd.execute_wrap(self)
+				except Exception as error:
+					self.fm.notify(error)
 				self.env.key_clear()
 	
 	def set_source(self, source, strip=False):
diff --git a/ranger/gui/widgets/taskview.py b/ranger/gui/widgets/taskview.py
index 909577d8..a99a567e 100644
--- a/ranger/gui/widgets/taskview.py
+++ b/ranger/gui/widgets/taskview.py
@@ -102,7 +102,10 @@ class TaskView(Widget, Accumulator):
 			self.env.key_clear()
 		else:
 			if hasattr(cmd, 'execute'):
-				cmd.execute_wrap(self)
+				try:
+					cmd.execute_wrap(self)
+				except Exception as error:
+					self.fm.notify(error)
 				self.env.key_clear()
 	
 	def get_list(self):