Baby Language Lab Scripts
A collection of data processing tools.
 All Classes Namespaces Files Functions Variables Pages
errors.py
Go to the documentation of this file.
1 ## @package parsers.errors
2 
3 ## This is an 'abstract' base class for custom exception classes.
4 class BllAppError(Exception):
5  ## Constructor
6  # @param self
7  # @param msg (string) a descriptive error message for this exception
8  # @param obj (object) the object that this exception pertains to (eg. an Utterance or Segment)
9  def __init__(self, msg, obj):
10  super(Exception, self).__init__(msg)
11  self.obj = obj
12  self.msg = msg
13 
14  ## This method is called by the Python runtime when a string representatin of this exception is requested (eg. the exception is printed)
15  # @param self
16  def __str__(self):
17  output = '%s:\n' % (self.__class__.__name__)
18  output += '-msg: "%s"\n' % (self.msg)
19  #output += '-obj: %s\n' % (self.obj)
20 
21  return output
22 
23 ## The class represents an error that has been detected in a TRS file.
24 # (For example, the error could be something an invalid transcriber code, or a missing I/C link code.)
26  ## Constructor
27  # Currenlty, this class exists only to differentiate warnings from errors. We might need to add more stuff here later...
28  # See superclass parameter descriptions.
29  def __init__(self, msg, obj):
30  BllAppError.__init__(self, msg, obj)
31 
32 ## This class represents a warning that has been detected in a TRS file.
33 # Warnings are not as serious as errors - for example, an utterance might not have a speaker specified.
35  ## Constructor
36  # Currenlty, this class exists only to differentiate warnings from errors. We might need to add more stuff here later...
37  # See superclass parameter descriptions.
38  def __init__(self, msg, obj):
39  BllAppError.__init__(self, msg, obj)