Class EncodableThrowable

  • All Implemented Interfaces:
    java.io.Serializable

    public final class EncodableThrowable
    extends java.lang.Object
    implements java.io.Serializable
    A wrapper around a Throwable for use with coders.

    Though Throwable is serializable, it doesn't override Object.equals(Object), which can lead to false positives in mutation detection for coders. This class provides a coder- safe way to pass exceptions around without running into problems like log spam.

    This class is not suitable for general-purpose equality comparison among Throwables and should only be used to pass a Throwable from one PTransform to another.

    See Also:
    Serialized Form
    • Method Detail

      • forThrowable

        public static EncodableThrowable forThrowable​(java.lang.Throwable throwable)
        Wraps throwable and returns the result.
      • throwable

        public java.lang.Throwable throwable()
        Returns the underlying Throwable.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object