diff --git a/src/site/xdoc/userguide/exceptions.xml b/src/site/xdoc/userguide/exceptions.xml new file mode 100644 index 000000000..b776c15df --- /dev/null +++ b/src/site/xdoc/userguide/exceptions.xml @@ -0,0 +1,120 @@ + + + + + + + + + The Commons Math User Guide - Exceptions + + +
+ + + Commons Math defines a set of exceptions in order to convey the + precise low-level cause of failure. + + + +

+ Starting from version 3.0, all exceptions generated by the + Commons Math code are unchecked (i.e. they inherit from + the standard RuntimeException class). + The main rationale supporting this design decision is that the + exceptions generated in the library are not recoverable: They most + of the time result from bad input parameters or some failure due to + numerical problems. + A thorough discussion of the pros and cons of checked and unchecked + exceptions can be read in + + this post by Bruce Eckel. +

+
+ + +

+ The exceptions defined by Commons Math follow the Java standard + hierarchies: +

+

+ +

+ In all of the above exception hierarchies, several subclasses can + exist, each conveying a specific underlying cause of the problem. +

+
+ + +
    +
  • Localization +

    + The detailed error messages (i.e. the string returned by the + + getLocalizedMessage method) can be localized. + However, besides the American/English default, French is the only language + for which a translation resource is available. +

    +
  • +
  • Exception "context" +

    + Every exception generated by Commons Math implements the + + ExceptionContextProvider interface. A call to the + + getContext method will return the + + ExceptionContext instance stored in the exception, which the + user can further customize by adding messages and/or any object. +

    +
  • +
+
+ +
+ +
diff --git a/src/site/xdoc/userguide/index.xml b/src/site/xdoc/userguide/index.xml index ba15fcb75..ec005a4a3 100644 --- a/src/site/xdoc/userguide/index.xml +++ b/src/site/xdoc/userguide/index.xml @@ -28,7 +28,7 @@
+
  • 15. Filters + +
  • +
  • 16. Exceptions + +