1 /* 2 * Copyright (c) 2021-2023. Roland T. Lichti, Kaiserpfalz EDV-Service. 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18 package de.kaiserpfalzedv.commons.api; 19 20 import lombok.Getter; 21 import lombok.ToString; 22 23 import java.util.UUID; 24 25 /** 26 * The base class for all checked exceptions of the KP RPG Services. 27 * 28 * @author klenkes74 {@literal <rlichti@kaiserpfalz-edv.de>} 29 * @since 2.0.0 2021-05-24 30 */ 31 @Getter 32 @ToString 33 public abstract class BaseException extends Exception { 34 /** 35 * A unique ID for this exception. 36 */ 37 private final UUID uuid = UUID.randomUUID(); 38 39 /** 40 * Constructs a new exception with the specified detail message. The 41 * cause is not initialized, and may subsequently be initialized by 42 * a call to {@link #initCause}. 43 * 44 * @param message the detail message. The detail message is saved for 45 * later retrieval by the {@link #getMessage()} method. 46 * @since 2.0.0 2021-05-24 47 */ 48 public BaseException(final String message) { 49 super(message); 50 } 51 52 /** 53 * Constructs a new exception with the specified detail message and 54 * cause. <p>Note that the detail message associated with 55 * {@code cause} is <i>not</i> automatically incorporated in 56 * this exception's detail message. 57 * 58 * @param message the detail message (which is saved for later retrieval 59 * by the {@link #getMessage()} method). 60 * @param cause the cause (which is saved for later retrieval by the 61 * {@link #getCause()} method). (A {@code null} value is 62 * permitted, and indicates that the cause is nonexistent or 63 * unknown.) 64 * @since 2.0.0 2021-05-24 65 */ 66 public BaseException(final String message, final Throwable cause) { 67 super(message, cause); 68 } 69 70 /** 71 * Constructs a new exception with the specified cause and a detail 72 * message of {@code (cause==null ? null : cause.toString())} (which 73 * typically contains the class and detail message of {@code cause}). 74 * This constructor is useful for exceptions that are little more than 75 * wrappers for other throwables (for example, {@link 76 * java.security.PrivilegedActionException}). 77 * 78 * @param cause the cause (which is saved for later retrieval by the 79 * {@link #getCause()} method). (A {@code null} value is 80 * permitted, and indicates that the cause is nonexistent or 81 * unknown.) 82 * @since 2.0.0 2021-05-24 83 */ 84 public BaseException(final Throwable cause) { 85 super(cause); 86 } 87 88 /** 89 * Constructs a new exception with the specified detail message, cause, suppression enabled or disabled, and 90 * writable stack trace enabled or disabled. 91 * 92 * @param message the detail message. 93 * @param cause the cause. (A {@code null} value is permitted, 94 * and indicates that the cause is nonexistent or unknown.) 95 * @param enableSuppression controls if suppression is enabled 96 * or disabled 97 * @param writableStackTrace controls if the stack trace should 98 * be writable 99 * @since 2.0.0 2021-05-24 100 */ 101 public BaseException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) { 102 super(message, cause, enableSuppression, writableStackTrace); 103 } 104 }