/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/program.py

  • Committer: Tim Marston
  • Date: 2014-02-12 21:51:49 UTC
  • Revision ID: tim@ed.am-20140212215149-msaxl7vo98il5i4a
added more commands

Show diffs side-by-side

added added

removed removed

21
21
 
22
22
import os, sys, getopt
23
23
import the
24
 
from vcs.vcs import Vcs
25
24
 
26
25
 
27
26
class Program:
186
185
                try:
187
186
                        instance.parse_command_line()
188
187
                        instance.run()
189
 
                except( getopt.GetoptError, self.UsageError ) as e:
 
188
                except ( getopt.GetoptError, self.UsageError ) as e:
190
189
                        self.print_usage( e.msg )
191
 
                except Vcs.VcsError as e:
 
190
                except self.FatalError as e:
192
191
                        message = e.msg.rstrip()
193
192
                        if the.verbose and hasattr( e, 'output' ) and e.output:
194
193
                                message += '\n\nOUTPUT:\n' + e.output.rstrip()
195
194
                        self.die( message )
196
 
                except self.FatalError as e:
197
 
                        self.die( e.msg )
198
195
 
199
196
 
200
197
        class UsageError( Exception ):
205
202
 
206
203
        class FatalError( Exception ):
207
204
 
208
 
                def __init__( self, message ):
 
205
                def __init__( self, message, output = None ):
209
206
                        self.msg = message
 
207
                        self.output = output