Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Leger2014-03-13 12:26:07 -0400
committerFrederic Leger2014-03-13 12:26:07 -0400
commitd67e0bec2951e6ef71ea5f35c7a7131b626a0e9d (patch)
tree66bf3419a47797ed516c68b4e692da3a4017e681 /python/src/tcf/errors.py
parentfd1994f9f5da5a9ae5d3f286b1385a0c4a993489 (diff)
downloadorg.eclipse.tcf-d67e0bec2951e6ef71ea5f35c7a7131b626a0e9d.tar.gz
org.eclipse.tcf-d67e0bec2951e6ef71ea5f35c7a7131b626a0e9d.tar.xz
org.eclipse.tcf-d67e0bec2951e6ef71ea5f35c7a7131b626a0e9d.zip
Python - services documentation.
Services can now be documented using sphinx.
Diffstat (limited to 'python/src/tcf/errors.py')
-rw-r--r--python/src/tcf/errors.py138
1 files changed, 122 insertions, 16 deletions
diff --git a/python/src/tcf/errors.py b/python/src/tcf/errors.py
index 9085e29b6..d37323c45 100644
--- a/python/src/tcf/errors.py
+++ b/python/src/tcf/errors.py
@@ -14,76 +14,166 @@ import time
import types
# Error report attribute names
-ERROR_CODE = "Code" # integer
-ERROR_TIME = "Time" # integer
-ERROR_SERVICE = "Service" # string
-ERROR_FORMAT = "Format" # string
-ERROR_PARAMS = "Params" # array
-ERROR_SEVERITY = "Severity" # integer
-ERROR_ALT_CODE = "AltCode" # integer
-ERROR_ALT_ORG = "AltOrg" # string
-ERROR_CAUSED_BY = "CausedBy" # object
+
+ERROR_CODE = "Code"
+"""Integer : error code value"""
+
+ERROR_TIME = "Time"
+"""Integer : error time"""
+
+ERROR_SERVICE = "Service"
+"""String : name of the service the error occured in"""
+
+ERROR_FORMAT = "Format"
+"""String : error format"""
+
+ERROR_PARAMS = "Params"
+"""List : a list of parameters for the given error"""
+
+ERROR_SEVERITY = "Severity"
+"""Integer : error severity"""
+
+ERROR_ALT_CODE = "AltCode"
+"""Integer : error alternative code value"""
+
+ERROR_ALT_ORG = "AltOrg"
+"""Integer : error alternative org???"""
+
+ERROR_CAUSED_BY = "CausedBy"
+"""Object : the cause of the error"""
# Error severity codes
SEVERITY_ERROR = 0
+"""Error"""
+
SEVERITY_WARNING = 1
+"""Warning"""
+
SEVERITY_FATAL = 2
+"""Fatal error"""
# Error code ranges
-# Standard TCF code range */
+# Standard TCF code range
CODE_STD_MIN = 0
+"""Minimum error code value"""
CODE_STD_MAX = 0xffff
+"""Maximum error code value"""
-# Service specific codes. Decoding requires service ID. */
+# Service specific codes. Decoding requires service ID.
CODE_SERVICE_SPECIFIC_MIN = 0x10000
+"""Service specific minimum error code value"""
CODE_SERVICE_SPECIFIC_MAX = 0x1ffff
+"""Service specific maximum error code value"""
-# Reserved codes - will never be used by the TCF standard */
+# Reserved codes - will never be used by the TCF standard
CODE_RESERVED_MIN = 0x20000
+"""Service specific reserved minimum error code value"""
CODE_RESERVED_MAX = 0x2ffff
+"""Service specific reserved maximum error code value"""
# Standard TCF error codes
TCF_ERROR_OTHER = 1
+"""Other TCF errors"""
+
TCF_ERROR_JSON_SYNTAX = 2
+"""JSON syntax error"""
+
TCF_ERROR_PROTOCOL = 3
+"""Protocol error"""
+
TCF_ERROR_BUFFER_OVERFLOW = 4
+"""Buffer overflow"""
+
TCF_ERROR_CHANNEL_CLOSED = 5
+"""Channel closed"""
+
TCF_ERROR_COMMAND_CANCELLED = 6
+"""Command canceled"""
+
TCF_ERROR_UNKNOWN_PEER = 7
+"""Unknown peer"""
+
TCF_ERROR_BASE64 = 8
+"""Base64 error"""
+
TCF_ERROR_EOF = 9
+"""End of file"""
+
TCF_ERROR_ALREADY_STOPPED = 10
+"""Already stopped"""
+
TCF_ERROR_ALREADY_EXITED = 11
+"""Already exited"""
+
TCF_ERROR_ALREADY_RUNNING = 12
+"""Already running"""
+
TCF_ERROR_ALREADY_ATTACHED = 13
+"""Already attached"""
+
TCF_ERROR_IS_RUNNING = 14
+"""Is running"""
+
TCF_ERROR_INV_DATA_SIZE = 15
+"""Invalid data size"""
+
TCF_ERROR_INV_CONTEXT = 16
+"""Invalid context"""
+
TCF_ERROR_INV_ADDRESS = 17
+"""Invalid address"""
+
TCF_ERROR_INV_EXPRESSION = 18
+"""Invalid expression"""
+
TCF_ERROR_INV_FORMAT = 19
+"""Invalid format"""
+
TCF_ERROR_INV_NUMBER = 20
+"""Invalid number"""
+
TCF_ERROR_INV_DWARF = 21
+"""Invalid dwarf"""
+
TCF_ERROR_SYM_NOT_FOUND = 22
+"""Symbol not found"""
+
TCF_ERROR_UNSUPPORTED = 23
+"""Unsupported"""
+
TCF_ERROR_INV_DATA_TYPE = 24
+"""Invalid data type"""
+
TCF_ERROR_INV_COMMAND = 25
+"""Invalid command"""
+
TCF_ERROR_INV_TRANSPORT = 26
+"""Invalid transport"""
+
TCF_ERROR_CACHE_MISS = 27
+"""Cache miss"""
+
TCF_ERROR_NOT_ACTIVE = 28
+"""Not active"""
_timestamp_format = "%Y-%m-%d %H:%M:%S"
class ErrorReport(Exception):
+ """TCF error report class.
+
+ :param msg: error report message
+ :param attrs: TCF error report attributes to initialise this error report
+ with. See **ERROR_***.
+ """
def __init__(self, msg, attrs):
super(ErrorReport, self).__init__(msg)
if type(attrs) is types.IntType:
attrs = {
- ERROR_CODE : attrs,
- ERROR_TIME : int(time.time() * 1000),
- ERROR_FORMAT : msg,
- ERROR_SEVERITY : SEVERITY_ERROR
+ ERROR_CODE: attrs,
+ ERROR_TIME: int(time.time() * 1000),
+ ERROR_FORMAT: msg,
+ ERROR_SEVERITY: SEVERITY_ERROR
}
self.attrs = attrs
caused_by = attrs.get(ERROR_CAUSED_BY)
@@ -96,15 +186,31 @@ class ErrorReport(Exception):
self.caused_by = ErrorReport(bf.getvalue(), errMap)
def getErrorCode(self):
+ """Get this exception error code.
+
+ :returns: This error report error code, or **0**
+ """
return self.attrs.get(ERROR_CODE) or 0
def getAltCode(self):
+ """Get this exception alternative error code.
+
+ :returns: This error report alternative error code, or **0**
+ """
return self.attrs.get(ERROR_ALT_CODE) or 0
def getAltOrg(self):
+ """Get this exception alternative org ???
+
+ :returns: This error report alernative org???, or **None**
+ """
return self.attrs.get(ERROR_ALT_ORG)
def getAttributes(self):
+ """Get this error attribute.
+
+ :returns: a :class:`dict` of this error attributes
+ """
return self.attrs

Back to the top