]> git.basschouten.com Git - openhab-addons.git/blob
e3db55d0553866641fbe64f2a3096de3bc6d4e09
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.salus.internal.rest;
14
15 import java.io.Serial;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jetty.client.HttpResponseException;
19
20 /**
21  * @author Martin GrzeĊ›lowski - Initial contribution
22  */
23 @NonNullByDefault
24 @SuppressWarnings("SerializableHasSerializationMethods")
25 public class HttpSalusApiException extends SalusApiException {
26     @Serial
27     private static final long serialVersionUID = 1L;
28     private final int code;
29     private final String msg;
30
31     public HttpSalusApiException(int code, String msg, HttpResponseException e) {
32         super("HTTP Error %s: %s".formatted(code, msg), e);
33         this.code = code;
34         this.msg = msg;
35     }
36
37     public HttpSalusApiException(int code, String msg) {
38         super("HTTP Error %s: %s".formatted(code, msg));
39         this.code = code;
40         this.msg = msg;
41     }
42
43     public int getCode() {
44         return code;
45     }
46
47     public String getMsg() {
48         return msg;
49     }
50 }