Changeset 3286

Show
Ignore:
Timestamp:
01/26/12 21:07:13 (4 months ago)
Author:
erkn
Message:

Better error handling

Location:
branches/mcxtrace-1.0/src/mcrun2
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/mcxtrace-1.0/src/mcrun2/main.py

    r3285 r3286  
    268268 
    269269    # Indicate end of setup / start of computations 
    270     LOG.info('<') 
     270    LOG.info('===') 
    271271 
    272272    # Set fixed parameters 
     
    302302                       len(i) == 2 and 
    303303                       all(map(is_decimal, i)), intervals.values())): 
    304             raise OptionValueError('Could not parse intervals.') 
     304            raise OptionValueError('Could not parse intervals -- result: %s' 
     305                                   % str(intervals)) 
    305306 
    306307        linear_interval = LinearInterval.from_range( 
     
    317318 
    318319if __name__ == '__main__': 
    319     main() 
     320    try: 
     321        main() 
     322    except KeyboardInterrupt: 
     323        exit(1) 
     324    except Exception, e: 
     325        LOG.fatal(str(e)) 
  • branches/mcxtrace-1.0/src/mcrun2/optimisation.py

    r3285 r3286  
    103103        LOG.info('Running Scanner, result file is "%s"' % self.outfile) 
    104104 
     105        if len(self.intervals) == 0: 
     106            LOG.fatal('No intervals specified! (e.g. lambda=1.0,5.0)') 
     107            exit(1) 
     108 
    105109        fid = open(self.outfile, 'w') 
    106110        wrote_header = False