CException
Instead of using Java-like many exception types, we decided to take a
different approach. We use a class CException, which is based on the class
java.lang.Exception. To differ between different exception types we use a
code and an optional text.
Constructors
The most used constructor is the one with an integer code:
public CException(final int aCode);
Another constructor takes over an existing exception:
public CException(final Throwable aException);
The transfer of a message result is done like this:
public CException(@NotNull final CResult aError);
The text of the result is also transferred to the exception.
Adding the exception text
Adding the message text is analogous to forming a text with a StringBuilder:
public CException append(final boolean aValue);
public CException append(final byte aValue);
public CException append(final char aValue);
public CException append(final double aValue);
public CException append(final float aValue);
public CException append(final int aValue);
public CException append(final long aValue);
public CException append(final Object aObj);
public CException append(final short aValue);
public CException append(final String aValue);
Getter
There are getters for the code and the text.
public int getCode();
public String getMessage();
Another method returns a combined message result:
public CResult getError();
A combined text with code results in the following method:
public String getCombinedText();