def check_message(keywords, message):
 (exc_type, exc_value, exc_traceback) = sys.exc_info()
 if set(str(exc_value).split(' ')).issuperset(set(keywords)):
  exc_value._safe_message = message
  raise

def check_message ( keywords , message ) : ( exc_type , exc_value , exc_traceback ) = sys . exc_info ( ) if set ( str ( exc_value ) . split ( ' ' ) ) . issuperset ( set ( keywords ) ) : exc_value . _safe_message = message raise
checks an exception for given keywords and raises a new actionerror with the desired message if the keywords are found .