code: def extract_error_message(cls, e):
          
          message = str(e)
          try:
              if isinstance(e.args, tuple) and len(e.args) > 1:
                  message = e.args[1]
          except Exception:
              pass
          return message
docs: Extract error message for queries