summaryrefslogtreecommitdiff
path: root/support/arara/source/src/main/kotlin/org/islandoftex/arara/model/AraraException.kt
diff options
context:
space:
mode:
Diffstat (limited to 'support/arara/source/src/main/kotlin/org/islandoftex/arara/model/AraraException.kt')
-rw-r--r--support/arara/source/src/main/kotlin/org/islandoftex/arara/model/AraraException.kt50
1 files changed, 50 insertions, 0 deletions
diff --git a/support/arara/source/src/main/kotlin/org/islandoftex/arara/model/AraraException.kt b/support/arara/source/src/main/kotlin/org/islandoftex/arara/model/AraraException.kt
new file mode 100644
index 0000000000..6bf2d1e617
--- /dev/null
+++ b/support/arara/source/src/main/kotlin/org/islandoftex/arara/model/AraraException.kt
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.model
+
+/**
+ * Implements the specific exception model for arara.
+ *
+ * @author Island of TeX
+ * @version 5.0
+ * @since 4.0
+ */
+class AraraException : Exception {
+ /**
+ * The underlying exception, used to hold more details
+ * on what really happened
+ */
+ val exception: Exception?
+
+ /**
+ * Constructor. Takes the exception message.
+ * @param message The exception message.
+ */
+ constructor(message: String) : super(message) {
+ this.exception = null
+ }
+
+ /**
+ * Constructor. Takes the exception message and the underlying exception.
+ * @param message The exception message.
+ * @param exception The underlying exception object.
+ */
+ constructor(message: String, exception: Exception) : super(message) {
+ this.exception = exception
+ }
+
+ /**
+ * Constructor. Takes the exception message and the underlying exception.
+ * @param message The exception message.
+ * @param throwable The underlying exception as generic throwable.
+ */
+ constructor(message: String, throwable: Throwable) : super(message) {
+ this.exception = RuntimeException(throwable)
+ }
+
+ /**
+ * Checks if there is an underlying exception defined in the current object.
+ * @return A boolean value indicating if the current object has an
+ * underlying exception.
+ */
+ fun hasException(): Boolean = exception?.message != null
+}