Acspy.Common.Err
index
/alma/ACS-2016.6/ACSSW/lib/python/site-packages/Acspy/Common/Err.py

Python helper class(es) for the ACS Error System.
 
TODO:
- nada

 
Modules
       
ACSErr
ACSLog

 
Classes
       
Acspy.Common.ErrorTrace.ErrorTraceHelper(__builtin__.object)
ACSError

 
class ACSError(Acspy.Common.ErrorTrace.ErrorTraceHelper)
    ACSError is nearly identical to the C++ ACSError class. Developers who want to
know what methods are available for the various ACS Error System generated
exception classes should pay close attention to this class.
 
 
Method resolution order:
ACSError
Acspy.Common.ErrorTrace.ErrorTraceHelper
__builtin__.object

Methods defined here:
__init__(self, error_type, error_code, exception=None, description='None', nvSeq=None, create=1, severity=None)
The constructor basically allows the developer to specify any number of
parameters for an error trace, but requires none.  Python is flexible enough
to let us do this.
 
Parameters:
- error_type is the error type (a long)
- error_code is the error code (a long)
- exception is a previous exception from the ACS Error System, or a Python
native exception, in which case, an ErrorTrace will be constructed. The traceback
should be ok in most cases, but if you find that it isn't, a possible workaround is
converting the python exception to an ACS exception using pyExceptionToCORBA()
before passing it to an ACSError constructor. Remember, that if you don't use
pyExceptionToCORBA(), if
you are dealing with a native exception, you must pass create=1 to the ACSError
constructor.
- description is a stringified description of the errror
- nvSeq is a name-value sequence describing the error condition. Each value
should be of the type ACSErr.NameValue
- create with a value of 1 implies error information will be added to the stack
- severity is the ACSErr severity of the error
 
Returns: Nothing
 
Raises: Nothing
getErrorTrace(self)
Overridden
setErrorTrace(self, et_obj)
Sets the member error trace
 
Parameters: et_obj is an ACSErr.ErrorTrace instances
 
Returns: Nothing
 
Raises: Nothing

Methods inherited from Acspy.Common.ErrorTrace.ErrorTraceHelper:
Print(self)
Prints errortrace information to standard out.
 
Parameters: None
 
Returns: Nothing
 
Raises: Nothing
addData(self, name, value)
Adds data to the current error
 
Parameters: name and value will both be converted to strings.
 
Returns: Nothing
 
Raises: Nothing
errorTraceToString(self, error_trace, ws)
Converts an error trace to a human-readable string.
 
Parameters: error_trace is an errortrace
ws is whitespace
 
Returns: Nothing
 
Raises: Nothing
getData(self, name)
Gets previously set data from the ErrorTrace.
 
Parameters: name of the data as defined by the addData method
 
Returns: a list of previously set data (stringified) with the matching
name. This list can be empty if there are no matches
 
Raises: Nothing
getDescription(self)
Returns copy of description of current error. 
 
Parameters: None
 
Returns: Nothing
 
Raises: Nothing
getErrorCode(self)
Returns error code
 
Parameters: None
 
Returns: error code
 
Raises: Nothing
getErrorType(self)
Returns error type
 
Parameters: None
 
Returns: error type
 
Raises: Nothing
getFileName(self)
Returns file name information of the error
 
Parameters: None
 
Returns: filename
 
Raises: Nothing
getHostName(self)
Returns host name information of the error
 
Parameters: None
 
Returns: hostname
 
Raises: Nothing
getLineNumber(self)
Returns line number information of the error
 
Parameters: None
 
Returns: line number
 
Raises: Nothing
getNext(self)
Moves to the next errortrace element and returns a reference to it.
 
Parameters: None
 
Returns: the next errortrace element or None if it does not exist
 
Raises: Nothing
getProcess(self)
Returns process information of the error. Its name or process ID.
 
Parameters: None
 
Returns: Process ID
 
Raises: Nothing
getRoutine(self)
Returns routine information of the error
 
Parameters: None
 
Returns: routine name
 
Raises: Nothing
getSeverity(self)
Returns error severity
 
Parameters: None
 
Returns: Severity
 
Raises: Nothing
getThread(self)
Returns thread information of the error. The name of thread or its ID.
 
Parameters: None
 
Returns: Thread ID
 
Raises: Nothing
getTimeStamp(self)
Returns time stamp of the error in 100th of nanoseconds.
 
Parameters: None
 
Returns: time stamp
 
Raises: Nothing
isOK(self)
Returns 1 if errortrace does not represent error otherwise 0.
 
Parameters: None
 
Returns: 0 or 1
 
Raises: Nothing
log(self, logger, priority=ACS_LOG_ERROR)
Logs errortrace information into the ACS logging system.
 
Parameters:
- priorty which will be used for logging the error
 
Returns: Nothing
 
Raises: Nothing
printET(self, error_trace, ws)
Prints one error trace to standard out.
 
Parameters: et is an errortrace
ws is whitespace
 
Returns: Nothing
 
Raises: Nothing
setData(self, name, value)
Sets data within the ErrorTrace, adding it if it has not been
previously set.
 
Parameters: name and value will both be converted to strings.
 
Returns: Nothing
 
Raises: Nothing
setError(self, error_code=None, error_type=None)
Sets the error type/code
 
Parameters: self-explanatory
 
Returns: Nothing
 
Raises: ValueError if invalid parameters are given
setFileName(self, file_name)
Sets file name
 
Parameters: name of the file
 
Returns: Nothing
 
Raises: Nothing
setLineNumber(self, line_number)
Sets line number
 
Parameters: the line number
 
Returns: Nothing
 
Raises: Nothing
setSeverity(self, severity)
Sets error severity
 
Parameters: severity of the error
 
Returns: Nothing
 
Raises: Nothing
setTimeStamp(self, time)
Sets time stamp of the error in 100th of nanoseconds.
 
Parameters: the time stamp of the error
 
Returns: Nothing
 
Raises: Nothing

Data descriptors inherited from Acspy.Common.ErrorTrace.ErrorTraceHelper:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
addComplHelperMethods(compl_obj)
Utility function designed to add some useful helper method to pure-CORBA
ACSErr.Completion object instances. This means that if you invoke some
CORBA method which returns a completion (e.g., the get_sync method of BACI
properties), you can then run this function on it which will dynamically
attach the following methods:
- getTimeStamp() - returns the ACS::Time when the completion was created
- getType() - returns the completions error type
- getCode() - returns the completions error code
- isErrorFree() - returns true if the completion does not contain an error trace
- log() - logs the completions error trace
- addData(name, value) - adds arbitrary data to the error trace. Fails if
the error trace does not exist
 
Notes:
- no check is performed to ensure compl_obj is actually derived from
ACSErr.Completion.
 
Returns: Nothing. After invoking this method, the compl_obj parameter
has the methods mentioned above attached to it.
 
Raises: Nothing.
pyExceptionToCORBA(native_ex)
Useful function which converts a native Python function to an ACS Error
System CORBA exception. This is only to be used in situations
immediately after the native Python exception has can been caught.
Such an example is:
    try:
        print joe
    except NameError, ex:
        corba_ex = pyExceptionToCORBA(ex)
        raise corba_ex
 
Parameters:
- native_ex is a native Python exception. This should not be derived
from any CORBA class.
 
Returns: native_ex converted to a
ACSErrTypePythonNativeImpl.ACSErrTypePythonNativeExImpl
 
Raises: ???

 
Data
        __revision__ = '$Id: Err.py,v 1.1.1.1 2012/03/07 17:40:45 acaproni Exp $'