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.millheat.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.millheat.internal.dto.AbstractRequest;
17 import org.openhab.binding.millheat.internal.dto.AbstractResponse;
20 * The {@link MillheatCommunicationException} class wraps exceptions raised when communicating with the API
22 * @author Arne Seime - Initial contribution
25 public class MillheatCommunicationException extends Exception {
26 private static final long serialVersionUID = 1L;
27 private int errorCode = 0;
29 public MillheatCommunicationException(final String message, final Throwable cause) {
30 super(message, cause);
33 public MillheatCommunicationException(final String message) {
37 public MillheatCommunicationException(final AbstractRequest request, final AbstractResponse response) {
38 super("Server responded with error to request " + request.getClass().getSimpleName() + "/"
39 + request.getRequestUrl() + ": " + response.errorCode + "/" + response.errorName + "/"
40 + response.errorDescription);
41 this.errorCode = response.errorCode;
44 public int getErrorCode() {