#3070 document convertFault method
Merged 2 years ago by tkopecek. Opened 2 years ago by ktdreyer.
ktdreyer/koji convertfault-docstring  into  master

file modified
+11 -2
@@ -437,9 +437,18 @@ 

      pass

  

  

- # A function to get create an exception from a fault

  def convertFault(fault):

-     """Convert a fault to the corresponding Exception type, if possible"""

+     """Convert a fault to the corresponding Exception type, if possible.

+ 

+     This method compares this fault's faultCode to all the known faultCodes

+     in the GenericError and sub-classes defined above. If there is a matching

+     faultCode, return that new Exception class. If there is no match, just

+     return the fault object as-is.

+ 

+     :param xmlrpc.client.Fault fault: The XML-RPC fault from the hub.

+     :returns: one of the GenericError sub-classes, if possible.

+     :returns: fault instance, if no GenericError sub-classes matched.

+     """

      code = getattr(fault, 'faultCode', None)

      if code is None:

          return fault

Update the convertFault docstring to describe how the method converts faults, the fault parameter type, and possible return values.

Commit 113736b fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago
Metadata