]> git.basschouten.com Git - openhab-addons.git/blob
d29c65c38d50915a12b60ccefe89583ce2a9b802
[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.tellstick.internal.local;
14
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.eclipse.jdt.annotation.NonNullByDefault;
17 import org.tellstick.device.TellstickException;
18
19 /**
20  * {@link TelldusLocalException} is used when there is exception communicating with Telldus local API.
21  * This exception extends the Telldus Core exception.
22  *
23  * @author Jan Gustafsson - Initial contribution
24  */
25 @NonNullByDefault
26 public class TelldusLocalException extends TellstickException {
27
28     public TelldusLocalException(Exception source) {
29         super(null, 0);
30         this.initCause(source);
31     }
32
33     private static final long serialVersionUID = 3067179547449454711L;
34
35     @Override
36     public @NonNull String getMessage() {
37         Throwable throwable = getCause();
38         if (throwable != null) {
39             String localMessage = throwable.getMessage();
40             if (localMessage != null) {
41                 return localMessage;
42             }
43         }
44         return "";
45     }
46 }