Package org.orekit.errors
Class OrekitException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.orekit.errors.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 Summary
Constructors Constructor Description OrekitException(Throwable cause, Localizable specifier, Object... parts)
Simple constructor.OrekitException(Localizable specifier, Object... parts)
Simple constructor.OrekitException(Localizable message, Throwable cause)
Simple constructor.OrekitException(MathRuntimeException exception)
Simple constructor.OrekitException(OrekitException exception)
Copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getLocalizedMessage()
String
getMessage()
String
getMessage(Locale locale)
Gets the message in a specified locale.Object[]
getParts()
Get the variable parts of the error message.Localizable
getSpecifier()
Get the localizable specifier of the error message.static OrekitException
unwrap(MathRuntimeException exception)
Recover a OrekitException, possibly embedded in aMathRuntimeException
.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
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 messagecause
- 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 causespecifier
- 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 interfaceLocalizedException
- Parameters:
locale
- Locale in which the message should be translated- Returns:
- localized message
-
getMessage
public String getMessage()
- Overrides:
getMessage
in classThrowable
-
getLocalizedMessage
public String getLocalizedMessage()
- Overrides:
getLocalizedMessage
in classThrowable
-
getSpecifier
public Localizable getSpecifier()
Get the localizable specifier of the error message.- Specified by:
getSpecifier
in interfaceLocalizedException
- Returns:
- localizable specifier of the error message
-
getParts
public Object[] getParts()
Get the variable parts of the error message.- Specified by:
getParts
in interfaceLocalizedException
- Returns:
- a copy of the variable parts of the error message
-
unwrap
public static OrekitException unwrap(MathRuntimeException exception)
Recover a OrekitException, possibly embedded in aMathRuntimeException
.If the
MathRuntimeException
does not embed a OrekitException, a new one will be created.- Parameters:
exception
- MathRuntimeException to analyze- Returns:
- a (possibly embedded) OrekitException
-
-