CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/FWCore/ParameterSet/python/ExceptionHandling.py

Go to the documentation of this file.
00001 import inspect
00002 
00003 
00004 class ConfigError(Exception):
00005     """the most basic Error for CMS config"""
00006     pass
00007 
00008 
00009 class ModuleCloneError(ConfigError):
00010     pass
00011 
00012 
00013 def format_outerframe(number):
00014     """formats the outer frame 'number' to output like:
00015        In file foo.py, line 8:
00016           process.aPath = cms.Path(module1*module2)
00017 
00018        'number' is the number of frames to go back relative to caller.  
00019     """
00020     frame = inspect.stack()[number+1] #+1 because this routine adds another call
00021     return "In file %s, line %s:\n    %s" %(frame[1], frame[2], frame[4][0])
00022 
00023     
00024 def format_typename(object):
00025     """format the typename and return only the last part""" 
00026     return str(type(object)).split("'")[1].split(".")[-1]