source: CMIP6dreqbuild/trunk/srcMisc/xceptions.py @ 355

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreqbuild/trunk/srcMisc/xceptions.py@376
Revision 355, 773 bytes checked in by mjuckes, 5 years ago (diff)

adding python scripts

Line 
1"""Some exceptions used in the code"""
2
3class abortChecks(Exception):
4  """Raised when checks are aborted following failure of a critical test (e.g. file name cannot be parsed)."""
5  pass
6class loggedException(Exception):
7  """Raised after an exception has been caught and logged in a checking class, allowing execution to fall back to the loop over files."""
8  pass
9
10class baseException(Exception):
11  """Basic exception for general use in code."""
12
13  def __init__(self,msg):
14    self.msg = 'utils_c4:: %s' % msg
15
16  def __str__(self):
17        return unicode(self).encode('utf-8')
18
19  def __repr__(self):
20    return self.msg
21
22  def __unicode__(self):
23        return self.msg % tuple([force_unicode(p, errors='replace')
24                                 for p in self.params])
Note: See TracBrowser for help on using the repository browser.