]> git.basschouten.com Git - openhab-addons.git/blob
ab2c522e49a846501e2dfca80dfdaa66b149c218
[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.energidataservice.internal.exception;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * {@link DataServiceException} is a generic Energi Data Service exception thrown in case
19  * of communication failure or unexpected response. It is intended to be derived by
20  * specialized exceptions.
21  * 
22  * @author Jacob Laursen - Initial contribution
23  */
24 @NonNullByDefault
25 public class DataServiceException extends Exception {
26
27     private static final long serialVersionUID = 1L;
28     private int httpStatus = 0;
29
30     public DataServiceException(String message) {
31         super(message);
32     }
33
34     public DataServiceException(Throwable cause) {
35         super(cause);
36     }
37
38     public DataServiceException(String message, Throwable cause) {
39         super(message, cause);
40     }
41
42     public DataServiceException(String message, int httpStatus) {
43         super(message);
44         this.httpStatus = httpStatus;
45     }
46
47     public int getHttpStatus() {
48         return httpStatus;
49     }
50 }