Quellcode durchsuchen

Move Subcommand instantiation to run

To prevent duplication of error catching
Alois Mahdal vor 10 Jahren
Ursprung
Commit
c68008d4cf
1 geänderte Dateien mit 2 neuen und 4 gelöschten Zeilen
  1. 2
    4
      include/sardine.py

+ 2
- 4
include/sardine.py Datei anzeigen

@@ -99,11 +99,8 @@ class Subcommand(object):
99 99
 class App:
100 100
 
101 101
     def __init__(self, cmdargs):
102
+        self.cmdargs = cmdargs
102 103
         self._set_pluginpath()
103
-        try:
104
-            self.subcommand = Subcommand(cmdargs, self.pluginpath)
105
-        except SardinePluginError as e:
106
-            self.die(e)
107 104
 
108 105
     def _set_pluginpath(self):
109 106
         mypath = os.path.dirname(os.path.realpath(sys.argv[0]))
@@ -120,6 +117,7 @@ class App:
120 117
 
121 118
     def run(self):
122 119
         try:
120
+            self.subcommand = Subcommand(self.cmdargs, self.pluginpath)
123 121
             print self.subcommand.get_output()
124 122
         except SardinePluginError as e:
125 123
             self.die(e, 10)