]> git.basschouten.com Git - openhab-addons.git/blob
2eb2475551166fefd075e8f4947e5ef3b8720864
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.homeconnect.internal.client.exception;
14
15 import static java.lang.String.format;
16
17 import java.util.Date;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20
21 /**
22  * API communication exception
23  *
24  * @author Jonas BrĂ¼stel - Initial contribution
25  *
26  */
27 @NonNullByDefault
28 public class CommunicationException extends Exception {
29
30     private static final long serialVersionUID = 1L;
31
32     public CommunicationException(String message, Throwable cause) {
33         super(message, cause);
34     }
35
36     public CommunicationException(String message) {
37         super(message);
38     }
39
40     public CommunicationException(Throwable cause) {
41         super(cause);
42     }
43
44     public CommunicationException(int code, String message, String body) {
45         super(format("Communication error! response code: %d, message: %s, body: %s (Tried at %s)", code, message, body,
46                 new Date()));
47     }
48 }