diff --git a/scripts/run_command b/scripts/run_command
index 593b83ab9e713e920822f8423480c30699f051ec..f69b5db1a18962683a39c61fe7667ff92d725498 100755
--- a/scripts/run_command
+++ b/scripts/run_command
@@ -88,11 +88,7 @@ class RosShell(InteractiveConsole):
                 return self.runcode(c)
             else:
                 return True
-        except SyntaxError:
-            self.showsyntaxerror()
-            self.cache = ""
-            return False
-        except OverflowError:
+        except (SyntaxError, OverflowError):
             self.showsyntaxerror()
             self.cache = ""
             return False