def to_string()

in dataplex-quickstart-labs/00-resources/scripts/python/business-glossary-import/bg_import/error.py [0:0]


  def to_string(self) -> str:
    """Generates a string containing details on the error."""
    err = []
    err.append(f"{self.entry_type.value}")
    if self.line >= 1:
      err.append(f"Line {self.line}")
    if self.column >= 1:
      err.append(f"Column {self.column}")
    if err:
      err.append(":")
    if self.operation:
      err.append(
          f"Performing {self.operation}"
          f" on resource(s) [{(', ').join(self.resources)}]."
      )
    elif self.resources:
      err.append(f"On resource(s) [{(', ').join(self.resources)}].")
    if self.message is not None:
      err.append(f"{self.message}")

    error_msg = (" ").join(err)
    # Display the whole record line that contains the issue, and show the exact
    # part of it that needs to be fixed.
    if self.record is not None and self._is_column_field_set():
      error_msg = f"{error_msg}\n{self._add_record_information()}"

    return error_msg