Interface SparkErrorUtils

All Superinterfaces:
org.apache.spark.internal.Logging

public interface SparkErrorUtils extends org.apache.spark.internal.Logging
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.spark.internal.Logging

    org.apache.spark.internal.Logging.SparkShellLoggingFilter
  • Method Summary

    Modifier and Type
    Method
    Description
     
    <T> T
    tryOrIOException(scala.Function0<T> block)
    Execute a block of code that returns a value, re-throwing any non-fatal uncaught exceptions as IOException.
    <R extends Closeable, T>
    T
    tryWithResource(scala.Function0<R> createResource, scala.Function1<R,T> f)
     
    <T> T
    tryWithSafeFinally(scala.Function0<T> block, scala.Function0<scala.runtime.BoxedUnit> finallyBlock)
    Execute a block of code, then a finally block, but if exceptions happen in the finally block, do not suppress the original exception.

    Methods inherited from interface org.apache.spark.internal.Logging

    initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq
  • Method Details

    • tryOrIOException

      <T> T tryOrIOException(scala.Function0<T> block)
      Execute a block of code that returns a value, re-throwing any non-fatal uncaught exceptions as IOException. This is used when implementing Externalizable and Serializable's read and write methods, since Java's serializer will not report non-IOExceptions properly; see SPARK-4080 for more context.
      Parameters:
      block - (undocumented)
      Returns:
      (undocumented)
    • tryWithResource

      <R extends Closeable, T> T tryWithResource(scala.Function0<R> createResource, scala.Function1<R,T> f)
    • tryWithSafeFinally

      <T> T tryWithSafeFinally(scala.Function0<T> block, scala.Function0<scala.runtime.BoxedUnit> finallyBlock)
      Execute a block of code, then a finally block, but if exceptions happen in the finally block, do not suppress the original exception.

      This is primarily an issue with finally { out.close() } blocks, where close needs to be called to clean up out, but if an exception happened in out.write, it's likely out may be corrupted and out.close will fail as well. This would then suppress the original/likely more meaningful exception from the original out.write call.

      Parameters:
      block - (undocumented)
      finallyBlock - (undocumented)
      Returns:
      (undocumented)
    • stackTraceToString

      String stackTraceToString(Throwable t)