aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/XmppException.java
blob: b8c6c89d57b8dbe51b0fde52e80fdbd46d3a09f5 (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
package de.thedevstack.conversationsplus.xmpp.exceptions;

import eu.siacs.conversations.xml.Element;

/**
 *
 */
public class XmppException extends Exception {
    private Element context;
    /**
     * Constructs a new {@code Exception} that includes the current stack trace.
     */
    public XmppException() {
    }

    /**
     * Constructs a new {@code Exception} that includes the current stack trace.
     */
    public XmppException(Element context) {
        this.context = context;
    }

    /**
     * Constructs a new {@code Exception} with the current stack trace and the
     * specified cause.
     *
     * @param throwable the cause of this exception.
     */
    public XmppException(Throwable throwable) {
        super(throwable);
    }

    /**
     * Constructs a new {@code Exception} with the current stack trace and the
     * specified cause.
     *
     * @param throwable the cause of this exception.
     */
    public XmppException(Element context, Throwable throwable) {
        super(throwable);
        this.context = context;
    }

    @Override
    public String getMessage() {
        if (null != context) {
            return "Error in XMPP Element. XML element is: " + this.context.toString();
        } else {
            return super.getMessage();
        }
    }

    public Element getContext() {
        return context;
    }
}