private[kusto] def reportExceptionAndThrow()

in connector/src/main/scala/com/microsoft/kusto/spark/utils/KustoDataSourceUtils.scala [571:598]


  private[kusto] def reportExceptionAndThrow(
      reporter: String,
      exception: Throwable,
      doingWhat: String = "",
      cluster: String = "",
      database: String = "",
      table: String = "",
      requestId: String = "",
      shouldNotThrow: Boolean = false): Unit = {
    val whatFailed = if (doingWhat.isEmpty) "" else s"when $doingWhat"
    val clusterDesc = if (cluster.isEmpty) "" else s", cluster: '$cluster' "
    val databaseDesc = if (database.isEmpty) "" else s", database: '$database'"
    val tableDesc = if (table.isEmpty) "" else s", table: '$table'"
    val requestIdDesc = if (requestId.isEmpty) "" else s", requestId: '$requestId'"

    if (!shouldNotThrow) {
      logError(
        reporter,
        s"caught exception $whatFailed$clusterDesc$databaseDesc$tableDesc$requestIdDesc.${NewLine}EXCEPTION: ${ExceptionUtils
            .getStackTrace(exception)}")
      throw exception
    }

    logWarn(
      reporter,
      s"caught exception $whatFailed$clusterDesc$databaseDesc$tableDesc$requestIdDesc, exception ignored.${NewLine}EXCEPTION: ${ExceptionUtils
          .getStackTrace(exception)}")
  }