CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
errors Namespace Reference

Classes

class  NoMoreRetriesException
 
class  ServerNotFoundException
 

Functions

def check_response
 

Detailed Description

File that contains errors that can occur in CondDBFW.

Function Documentation

def errors.check_response (   check = "json")

Definition at line 27 of file errors.py.

References beamvalidation.exit(), callgraph.function, and str.

Referenced by uploads.uploader.close_upload_session(), uploads.uploader.get_all_hashes(), uploads.uploader.get_upload_session_id(), uploads.uploader.send_blob(), and uploads.uploader.send_payloads().

27 
28 def check_response(check="json"):
29 
30  def checker(function):
31 
32  def function_with_exception(self, *args, **kwargs):
33  return_value = None
34  try:
35  return_value = function(self, *args, **kwargs)
36  if check == "json":
37  dictionary = json.loads(return_value)
38  return dictionary
39  elif check == "base64":
40  return base64.b64decode(str(return_value))
41  else:
42  return return_value
43  except (ValueError, TypeError) as e:
44  # the server response couldn't be decoded, so write the log file data to file, and exit
45  self._outputter.write("Couldn't decode response in function '%s' - this is a fault on the server side. Response is:" % function.__name__)
46  self._outputter.write(return_value)
47  self.write_server_side_log(self._log_data)
48  exit()
49  # no need to catch any other exceptions, since this is left to the method that calls 'function'
50 
51  function_with_exception.__doc__ = function.__doc__
52 
53  return function_with_exception
54 
return checker
string function
Definition: callgraph.py:50
#define str(s)
def check_response
Definition: errors.py:27