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

import java.util.Arrays;

import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;

/**
 *
 */
public class UnexpectedIqPacketTypeException extends XmppException {
    private final IqPacket.TYPE current;
    private final IqPacket.TYPE[] expected;

    public UnexpectedIqPacketTypeException(Element context, IqPacket.TYPE current, IqPacket.TYPE... expected) {
        super(context);
        this.expected = expected;
        this.current = current;
    }

    @Override
    public String getMessage() {
        return "Unexpected IQ packet type '" + this.current + "' retrieved. One of " + Arrays.toString(expected) + " was expected.";
    }
}