Class OrekitException

  • All Implemented Interfaces:
    Serializable, LocalizedException
    Direct Known Subclasses:
    FrameAncestorException, TimeStampedCacheException, UnsupportedParameterException

    public class OrekitException
    extends RuntimeException
    implements LocalizedException
    This class is the base class for all specific exceptions thrown by the Orekit classes.

    When the Orekit classes throw exceptions that are specific to the package, these exceptions are always subclasses of OrekitException. When exceptions that are already covered by the standard java API should be thrown, like ArrayIndexOutOfBoundsException or InvalidParameterException, these standard exceptions are thrown rather than the Hipparchus specific ones.

    This class also provides utility methods to throw some standard java exceptions with localized messages.

    Author:
    Luc Maisonobe
    See Also:
    Serialized Form
    • Constructor Detail

      • OrekitException

        public OrekitException​(Localizable specifier,
                               Object... parts)
        Simple constructor. Build an exception with a translated and formatted message
        Parameters:
        specifier - format specifier (to be translated)
        parts - parts to insert in the format (no translation)
      • OrekitException

        public OrekitException​(OrekitException exception)
        Copy constructor.
        Parameters:
        exception - exception to copy from
        Since:
        5.1
      • OrekitException

        public OrekitException​(Localizable message,
                               Throwable cause)
        Simple constructor. Build an exception from a cause and with a specified message
        Parameters:
        message - descriptive message
        cause - underlying cause
      • OrekitException

        public OrekitException​(Throwable cause,
                               Localizable specifier,
                               Object... parts)
        Simple constructor. Build an exception from a cause and with a translated and formatted message
        Parameters:
        cause - underlying cause
        specifier - format specifier (to be translated)
        parts - parts to insert in the format (no translation)
      • OrekitException

        public OrekitException​(MathRuntimeException exception)
        Simple constructor. Build an exception from an Hipparchus exception
        Parameters:
        exception - underlying Hipparchus exception
        Since:
        6.0
    • Method Detail

      • getMessage

        public String getMessage​(Locale locale)
        Gets the message in a specified locale.
        Specified by:
        getMessage in interface LocalizedException
        Parameters:
        locale - Locale in which the message should be translated
        Returns:
        localized message
      • getSpecifier

        public Localizable getSpecifier()
        Get the localizable specifier of the error message.
        Specified by:
        getSpecifier in interface LocalizedException
        Returns:
        localizable specifier of the error message
      • getParts

        public Object[] getParts()
        Get the variable parts of the error message.
        Specified by:
        getParts in interface LocalizedException
        Returns:
        a copy of the variable parts of the error message
      • unwrap

        public static OrekitException unwrap​(MathRuntimeException exception)
        Recover a OrekitException, possibly embedded in a MathRuntimeException.

        If the MathRuntimeException does not embed a OrekitException, a new one will be created.

        Parameters:
        exception - MathRuntimeException to analyze
        Returns:
        a (possibly embedded) OrekitException