org.apache.commons.math3.exception

## Class MathRuntimeException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - org.apache.commons.math3.exception.MathRuntimeException

All Implemented Interfaces:
  java.io.Serializable, ExceptionContextProvider

    public class MathRuntimeException
    extends java.lang.RuntimeException
    implements ExceptionContextProvider

As of release 4.0, all exceptions thrown by the Commons Math code (except `NullArgumentException`) inherit from this class. In most cases, this class should not be instantiated directly: it should serve as a base class for implementing exception classes that describe a specific "problem".

Since:
  3.1
Version:
  $Id: MathRuntimeException.java 1416643 2012-12-03 19:37:14Z tn $
See Also:
  Serialized Form

### Field Summary

Fields
`private ExceptionContext` `context` Context.
`private static long` `serialVersionUID` Serializable version Id.

### Constructor Summary

Constructors
Constructor and Description
`MathRuntimeException(Localizable pattern, java.lang.Object... args)`

### Method Summary

Methods
`ExceptionContext` `getContext()` Gets a reference to the "rich context" data structure that allows to customize error messages and store key, value pairs in exceptions.
`java.lang.String` `getLocalizedMessage()`
`java.lang.String` `getMessage()`

### Methods inherited from class java.lang.Throwable

`fillInStackTrace, getCause, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### serialVersionUID

    private static final long serialVersionUID

Serializable version Id.

See Also:
  Constant Field Values

#### context

    private final ExceptionContext context

Context.

### Constructor Detail

#### MathRuntimeException

    public MathRuntimeException(Localizable pattern,
                        java.lang.Object... args)

Parameters:
  `pattern` - Message pattern explaining the cause of the error.
  `args` - Arguments.

### Method Detail

#### getContext

    public ExceptionContext getContext()

Gets a reference to the "rich context" data structure that allows to customize error messages and store key, value pairs in exceptions.

Specified by:
  `getContext` in interface `ExceptionContextProvider`
Returns:
  a reference to the exception context.

#### getMessage

    public java.lang.String getMessage()

Overrides:
  `getMessage` in class `java.lang.Throwable`

#### getLocalizedMessage

    public java.lang.String getLocalizedMessage()

Overrides:
  `getLocalizedMessage` in class `java.lang.Throwable`