class_docstr: Retries if an exception message equals or matches.
class_docstr_tok: ["Retries","if","an","exception","message","equals","or","matches","."]
code: def __init__(
      self,
      message: typing.Optional[str] = None,
      match: typing.Optional[str] = None,
  ) -> None:
      if message and match:
          raise TypeError(
              f"{self.__class__.__name__}() takes either 'message' or 'match', not both"
          )
  
      # set predicate
      if message:
  
          def message_fnc(exception: BaseException) -> bool:
              return message == str(exception)
  
          predicate = message_fnc
      elif match:
          prog = re.compile(match)
  
          def match_fnc(exception: BaseException) -> bool:
              return bool(prog.match(str(exception)))
  
          predicate = match_fnc
      else:
          raise TypeError(
              f"{self.__class__.__name__}() missing 1 required argument 'message' or 'match'"
          )
  
      super().__init__(predicate)
  
imports: import abc
  import re
  import typing
label_desc: Use image node_id 1 to create a new retry_if_exception_message object from inherited base classes: retry_if_exception with example: obj = retry_if_exception_message(message, match)