Package org.zkoss.lang

## Class CommonException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - org.zkoss.lang.CommonException

- All Implemented Interfaces:
    `java.io.Serializable`, `Messageable`, `MessageConst`

      public class CommonException
      extends java.lang.Exception
      implements Messageable

  The most fundamental non-runtime exception of Potix classes. All exceptions specific to Potix classes must derive from SystemException or CommonException.

  SystemException indicates programming bugs, while CommonException indicates exceptional cases.

  Author:
    tomyeh
  See Also:
    `SystemException`, Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.zkoss.mesg.MessageConst

      `MessageConst.Aide, MessageConst.BundleInfo`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected int` | `_code` |

    - ### Fields inherited from interface org.zkoss.mesg.MessageConst

      `NULL_CODE`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CommonException()` |
    `CommonException​(int code)` |
    `CommonException​(int code, java.lang.Object fmtArg)` |
    `CommonException​(int code, java.lang.Object[] fmtArgs)` |
    `CommonException​(int code, java.lang.Object[] fmtArgs, java.lang.Throwable cause)` | Constructs an CommonException by use of an error code.
    `CommonException​(int code, java.lang.Object fmtArg, java.lang.Throwable cause)` |
    `CommonException​(int code, java.lang.Throwable cause)` |
    `CommonException​(java.lang.String msg)` |
    `CommonException​(java.lang.String msg, java.lang.Throwable cause)` | Constructs an CommonException by specifying message directly.
    `CommonException​(java.lang.Throwable cause)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getCode()` | Gets the message code.

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

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, 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

    - #### _code

          protected int _code

  - ### Constructor Detail

    - #### CommonException

          public CommonException​(java.lang.String msg,
                                 java.lang.Throwable cause)

      Constructs an CommonException by specifying message directly.

    - #### CommonException

          public CommonException​(java.lang.String msg)

    - #### CommonException

          public CommonException​(java.lang.Throwable cause)

    - #### CommonException

          public CommonException()

    - #### CommonException

          public CommonException​(int code,
                                 java.lang.Object[] fmtArgs,
                                 java.lang.Throwable cause)

      Constructs an CommonException by use of an error code. The error code must be defined in one of properties files, e.g., msgsys.properties.
      Parameters:
        `code` - the error code
        `fmtArgs` - the format arguments
        `cause` - the chained throwable object

    - #### CommonException

          public CommonException​(int code,
                                 java.lang.Object fmtArg,
                                 java.lang.Throwable cause)

    - #### CommonException

          public CommonException​(int code,
                                 java.lang.Object[] fmtArgs)

    - #### CommonException

          public CommonException​(int code,
                                 java.lang.Object fmtArg)

    - #### CommonException

          public CommonException​(int code,
                                 java.lang.Throwable cause)

    - #### CommonException

          public CommonException​(int code)

  - ### Method Detail

    - #### getCode

          public final int getCode()

      Description copied from interface: `Messageable`
      Gets the message code.
      Specified by:
        `getCode` in interface `Messageable`
      Returns:
        the message code