summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/plugin/UnknownDependencyException.java
blob: dc5da65181238ae1cab7af98eac37f4dc6c9720c (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
51
52
53
54
55
56
57
58
59
60
61
62
63

package org.bukkit.plugin;

/**
 * Thrown when attempting to load an invalid Plugin file
 */
public class UnknownDependencyException extends Exception {

    private static final long serialVersionUID = 5721389371901775894L;
    private final Throwable cause;
    private final String message;

    /**
     * Constructs a new UnknownDependencyException based on the given Exception
     *
     * @param throwable Exception that triggered this Exception
     */
    public UnknownDependencyException(Throwable throwable) {
        this(throwable, "Unknown dependency");
    }

    /**
     * Constructs a new UnknownDependencyException with the given message
     *
     * @param message Brief message explaining the cause of the exception
     */
    public UnknownDependencyException(final String message) {
        this(null, message);
    }

    /**
     * Constructs a new UnknownDependencyException based on the given Exception
     *
     * @param message Brief message explaining the cause of the exception
     * @param throwable Exception that triggered this Exception
     */
    public UnknownDependencyException(final Throwable throwable, final String message) {
        this.cause = null;
        this.message = message;
    }

    /**
     * Constructs a new UnknownDependencyException
     */
    public UnknownDependencyException() {
        this(null, "Unknown dependency");
    }

    /**
     * If applicable, returns the Exception that triggered this Exception
     *
     * @return Inner exception, or null if one does not exist
     */
    @Override
    public Throwable getCause() {
        return cause;
    }

    @Override
    public String getMessage() {
        return message;
    }
}