blob: 6bf2d1e6172d4b10e5da17790fd33f569cbc24c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
}
|