Kann mich jemand führen Soll ich Exception oder RuntimeException verlängern?Benutzerdefinierte Ausnahmeklasse - Soll ich Runtime Exception oder Exception verlängern?
Normalerweise ist es für Validierungen, unerwartete Ausnahmen verwendet wird, Benutzerdefinierte Ausnahme, Raise, wenn Business-Logik usw. schlägt fehl
Unten ist meine benutzerdefinierte Ausnahmeklasse.
/**
* The class <code>BaseException</code> is a custom exception class.
* @author Pratiyush Kumar Singh
*/
public class BaseException extends Exception {
static final long serialVersionUID = -3387516993124229948L;
/**
* Constructs a new exception.
*/
public BaseException() {
super();
}
/**
* Constructs a new exception with the specified detail message.
* @param message - It contains the error message.
*/
public BaseException(String message) {
super(message);
}
/**
* Constructs a new exception with the specified detail message.
* @param message - It contains the error message.
* @param cause - Instance of Throwable.
*/
public BaseException(String message, Throwable cause) {
super(message, cause);
}
}