botsense  3.2.0
RoadNarrows Client-Server Proxied Services Framework
BotSense.BotSenseError Namespace Reference

BotSense Error Classes and Routines. More...

Classes

class  BotSenseError
 

Functions

def StrError (ecode)
 
def ChkType (obj, T)
 
def ChkReturnIsOk (rc, emsg=None)
 
def ChkReturnIsNonNeg (rc, emsg=None)
 

Detailed Description

BotSense Error Classes and Routines.

LastChangedDate
2010-09-13 10:25:05 -0600 (Mon, 13 Sep 2010)
Rev
581
See also
PyDoc Generated Documentation
Author
Robin Knight (robin.nosp@m..kni.nosp@m.ght@r.nosp@m.oadn.nosp@m.arrow.nosp@m.s.co.nosp@m.m)

Function Documentation

def BotSense.BotSenseError.ChkReturnIsNonNeg (   rc,
  emsg = None 
)
Check if return is non-negative.

    Raises a BotSenseError exception if false.

    Parameters:
      rc    - BotSense return code.
      emsg  - Optional error message string.

Definition at line 117 of file BotSenseError.py.

117 def ChkReturnIsNonNeg(rc, emsg=None):
118  """ Check if return is non-negative.
119 
120  Raises a BotSenseError exception if false.
121 
122  Parameters:
123  rc - BotSense return code.
124  emsg - Optional error message string.
125  """
126  if rc < 0:
127  raise BotSenseError(rc, emsg)
def ChkReturnIsNonNeg(rc, emsg=None)
def BotSense.BotSenseError.ChkReturnIsOk (   rc,
  emsg = None 
)
Check if return is ok (BsOk).

    Raises a BotSenseError exception if false.

    Parameters:
      rc    - BotSense return code.
      emsg  - Optional error message string.

Definition at line 103 of file BotSenseError.py.

103 def ChkReturnIsOk(rc, emsg=None):
104  """ Check if return is ok (BsOk).
105 
106  Raises a BotSenseError exception if false.
107 
108  Parameters:
109  rc - BotSense return code.
110  emsg - Optional error message string.
111  """
112  if rc != bsCore.BS_OK:
113  raise BotSenseError(rc, emsg)
def ChkReturnIsOk(rc, emsg=None)
def BotSense.BotSenseError.ChkType (   obj,
  T 
)
Check of oject is an instance of type T.

    Raises a BotSenseError exception if false.

    Parameters:
      obj   - Object instance.
      T     - Required type.

Definition at line 82 of file BotSenseError.py.

82 def ChkType(obj, T):
83  """ Check of oject is an instance of type T.
84 
85  Raises a BotSenseError exception if false.
86 
87  Parameters:
88  obj - Object instance.
89  T - Required type.
90  """
91  if not isinstance(obj, T):
92  if hasattr(T, '__name__'):
93  name = T.__name__
94  elif hasattr(T, '__class__.__name__'):
95  name = T.__class__.__name__
96  else:
97  name = repr(T)
98  raise BotSenseError(bsCore.BS_ECODE_BAD_VAL,
99  "Object type is not the '%s' required type." % (name))
def BotSense.BotSenseError.StrError (   ecode)
Get the error string describing the BotSense error code.
    
    The absolute value of the error code is taken prior retrieving the
    string. An unknown or out-of-range error code will be mapped to
    BS_ECODE_BADEC.
  
    Parameters:
      ecode     - BotSense error code.

    Return:
      The appropriate error code string.

Definition at line 62 of file BotSenseError.py.

Referenced by BotSense.BotSenseError.BotSenseError.__str__().

62 def StrError(ecode):
63  """ Get the error string describing the BotSense error code.
64 
65  The absolute value of the error code is taken prior retrieving the
66  string. An unknown or out-of-range error code will be mapped to
67  BS_ECODE_BADEC.
68 
69  Parameters:
70  ecode - BotSense error code.
71 
72  Return:
73  The appropriate error code string.
74  """
75  sErr = bsCore.bsStrError(ecode)
76  if not sErr:
77  sErr = 'Error'
78  return sErr