2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.mybmw.internal.handler.backend;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * The {@link NetworkException} Data Transfer Object
21 * @author Bernd Weymann - Initial contribution
22 * @author Martin Grassl - extend Exception
25 public class NetworkException extends Exception {
27 private static final long serialVersionUID = 123L;
29 private String url = "";
30 private int status = -1;
31 private String reason = "";
32 private String body = "";
34 public NetworkException() {
37 public NetworkException(String url, int status, @Nullable String reason, @Nullable String body) {
40 this.reason = reason != null ? reason : "";
41 this.body = body != null ? body : "";
44 public NetworkException(String url, int status, @Nullable String reason, @Nullable String body, Throwable cause) {
48 this.reason = reason != null ? reason : "";
49 this.body = body != null ? body : "";
52 public NetworkException(String message) {
54 this.reason = message;
57 public NetworkException(Throwable cause) {
61 public NetworkException(String message, Throwable cause) {
62 super(message, cause);
63 this.reason = message;
66 public String getUrl() {
70 public void setUrl(String url) {
74 public int getStatus() {
78 public void setStatus(int status) {
82 public String getReason() {
86 public void setReason(String reason) {
90 public String getBody() {
94 public void setBody(String body) {
99 public String toString() {
100 return "NetworkException [url=" + url + ", status=" + status + ", reason=" + reason + ", body=" + body + "]";