Show
Ignore:
Timestamp:
09/27/05 20:34:31 (19 years ago)
Author:
jerome
Message:

Ensure that human made errors (like incorrect command line options)
don't produce a traceback anymore. No need to frighten users with
such complete tracebacks and email reporting each time they mistype
some command.
Makes pykosd check more carefully the values of its command line options.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/warnpykota

    r2344 r2512  
    2929import pwd 
    3030 
    31 from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_ 
     31from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
    3232from pykota.config import PyKotaConfigError 
    3333from pykota.storage import PyKotaStorageError 
     
    108108        printers = self.storage.getMatchingPrinters(options["printer"]) 
    109109        if not printers : 
    110             raise PyKotaToolError, _("There's no printer matching %s") % options["printer"] 
     110            raise PyKotaCommandLineError, _("There's no printer matching %s") % options["printer"] 
    111111        alreadydone = {} 
    112112        for printer in printers : 
     
    155155            sender.display_version_and_quit() 
    156156        elif options["users"] and options["groups"] :     
    157             raise PyKotaToolError, _("incompatible options, see help.") 
     157            raise PyKotaCommandLineError, _("incompatible options, see help.") 
    158158        else : 
    159159            retcode = sender.main(args, options) 
    160160    except KeyboardInterrupt :         
    161161        sys.stderr.write("\nInterrupted with Ctrl+C !\n") 
     162    except PyKotaCommandLineError, msg :     
     163        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg)) 
    162164    except SystemExit :         
    163165        pass