-
Notifications
You must be signed in to change notification settings - Fork 215
/
MqttSubscribeException.java
63 lines (53 loc) · 2.36 KB
/
MqttSubscribeException.java
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
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.ditto.connectivity.service.messaging.mqtt.hivemq.client;
import java.io.Serial;
import javax.annotation.Nullable;
import org.eclipse.ditto.connectivity.service.messaging.mqtt.hivemq.message.subscribe.GenericMqttSubscribe;
/**
* This exception is thrown to indicate that subscribing a client via one or multiple Subscribe messages
* ({@link GenericMqttSubscribe}) failed for some reason.
*/
public sealed class MqttSubscribeException extends RuntimeException
permits AllSubscriptionsFailedException, SomeSubscriptionsFailedException {
@Serial private static final long serialVersionUID = 1936431587204652088L;
/**
* Constructs a {@code MqttSubscribeException} object for the specified String and Throwable argument.
*
* @param detailMessage the detail message of the exception.
* @param cause the Throwable that caused the constructed exception or {@code null} if the cause cannot be
* determined.
* @throws NullPointerException if {@code failedSubscriptionStatuses} is {@code null}.
* @throws IllegalArgumentException if {@code failedSubscriptionStatuses} is empty.
*/
public MqttSubscribeException(final String detailMessage, @Nullable final Throwable cause) {
super(detailMessage, cause);
}
/**
* Constructs a {@code MqttSubscribeException} object.
*/
public MqttSubscribeException() {
super();
}
/**
* Constructs a {@code MqttSubscribeException} object for the specified Throwable argument.
* The detail message is taken over from the argument.
*
* @param cause the Throwable that caused the constructed exception.
* @throws NullPointerException if {@code failedSubscriptionStatuses} is {@code null}.
* @throws IllegalArgumentException if {@code failedSubscriptionStatuses} is empty.
*/
public MqttSubscribeException(@Nullable final Throwable cause) {
super(null != cause ? cause.getMessage() : null, cause);
}
}