Class WrappedError

  • All Implemented Interfaces:
    ExtraInfo, Serializable

    public class WrappedError
    extends Error
    implements ExtraInfo

    A wrapped error may be used to rethrow any throwable in a context where Error is expected. As this is not often the case, you probably want to use WrappedException to wrap checked exceptions.

    This could be accomplished by rethrowing with Error directly, but having this distinct class provides more meaning as well as the ability to catch wrapped errors while letting all other errors go through directly.

    Catching WrappedError may be used to unwrap expected throwable types.

    Author:
    AO Industries, Inc.
    See Also:
    Serialized Form
    • Constructor Detail

      • WrappedError

        public WrappedError​(Throwable cause)
        Uses extra info of the original cause when it is an ExtraInfo.
      • WrappedError

        public WrappedError​(Throwable cause,
                            Object... extraInfo)
        Parameters:
        extraInfo - No defensive copy
      • WrappedError

        public WrappedError​(String message,
                            Throwable cause)
        Uses extra info of the original cause when it is an ExtraInfo.
      • WrappedError

        public WrappedError​(String message,
                            Throwable cause,
                            Object... extraInfo)
        Parameters:
        extraInfo - No defensive copy