CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
rrapi.RRApiError Class Reference
Inheritance diagram for rrapi.RRApiError:
Exception

Public Member Functions

def __init__
 
def __str__
 

Public Attributes

 code
 
 message
 
 stack
 
 url
 

Detailed Description

API Exception class

Definition at line 10 of file rrapi.py.

Constructor & Destructor Documentation

def rrapi.RRApiError.__init__ (   self,
  resp 
)
Construct exception by providing response object.

Definition at line 15 of file rrapi.py.

15 
16  def __init__(self, resp):
17  """
18  Construct exception by providing response object.
19  """
20  if isinstance(resp, str):
21  self.message = resp
22  else:
23  self.url = resp.geturl()
24  self.code = resp.getcode()
25  self.stack = None
26  for line in resp.read().split("\n"):
27  if self.stack == None:
28  m = re.search("<pre>(.*)", line)
29  if m != None:
30  self.stack = m.group(1)
31  m = re.search("^.+\.([^\.]+: .*)$", self.stack)
32  if m != None:
33  self.message = m.group(1)
34  else:
35  self.message = line
36  else:
37  m = re.search("(.*)</pre>", line)
38  if m != None:
39  self.stack = self.stack + "\n" + m.group(1)
40  break
41  else:
42  self.stack = self.stack + "\n" + line
def __init__
Definition: rrapi.py:15

Member Function Documentation

def rrapi.RRApiError.__str__ (   self)
Get message 

Definition at line 43 of file rrapi.py.

References util.rrapi.RRApiError.message, rrapi.RRApiError.message, iniparser.ConfigData.message, cscdqm::Exception.message, and MonitorElementData::QReport::QValue.message.

43 
44  def __str__(self):
45  """ Get message """
46  return self.message

Member Data Documentation

rrapi.RRApiError.code

Definition at line 23 of file rrapi.py.

rrapi.RRApiError.message

Definition at line 20 of file rrapi.py.

Referenced by rrapi.RRApiError.__str__().

rrapi.RRApiError.stack

Definition at line 24 of file rrapi.py.

rrapi.RRApiError.url

Definition at line 22 of file rrapi.py.

Referenced by rrapi.RRApi.get().