Changeset 888

Show
Ignore:
Timestamp:
04/12/07 11:28:30 AM (1 year ago)
Author:
chris
Message:

Eddie will now throw an error and exit if a config file cannot be read.

Ref #51.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eddie/trunk/bin/eddie.py

    r862 r888  
    525525    try: 
    526526        main() 
     527     
     528    except parseConfig.ConfigError: 
     529        sys.exit(1) 
     530     
    527531    except:                # catch any uncaught exceptions so we can log them 
    528532        e = sys.exc_info() 
  • eddie/trunk/lib/common/parseConfig.py

    r862 r888  
    3838import config, log, utils 
    3939 
     40 
     41#### Exceptions #### 
     42 
     43class ConfigError(Exception): 
     44    pass 
     45 
     46 
     47 
     48#### Classes #### 
    4049 
    4150class State: 
     
    363372 
    364373    try: 
    365             conf = open(file, 'r') 
    366     except IOError: 
    367         print "Error opening file '%s'" % file; 
    368         log.log( "<parseConfig>readFile(), Error, Cannot open '%s' - skipping" % (file), 4 ) 
    369         return 
     374        conf = open(file, 'r') 
     375    except IOError, e: 
     376        msg = "Error opening file '%s': %s" % (file, str(e)) 
     377        sys.stderr.write(msg + '\n') 
     378        log.log( msg, 4 ) 
     379        raise ConfigError(msg) 
    370380 
    371381    # add this filename to the list of config files