2 * Copyright (c) 2010-2024 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.freeathomesystem.internal.util;
15 import java.util.Objects;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
21 * The {@link FreeAtHomeHttpCommunicationException} is responsible for handling the communication exception to the SysAp
24 * @author Andras Uhrin - Initial contribution
28 public class FreeAtHomeHttpCommunicationException extends Exception {
29 private static final long serialVersionUID = -817364286035448863L;
30 private String errorMessage = "Unknown_Exception";
31 private int errorCode;
33 public FreeAtHomeHttpCommunicationException(int errorCode, String message) {
36 this.errorMessage = message;
37 this.errorCode = errorCode;
40 public @Nullable String getMessage() {
41 return this.errorMessage;
44 public int getErrorCode() {
45 return this.errorCode;
49 public String toString() {
50 return "FreeAtHomeHttpCommunicationException [errorMessage=" + errorMessage + ", errorCode=" + errorCode + "]";
54 public int hashCode() {
55 return Objects.hash(errorCode, errorMessage);
59 public boolean equals(@Nullable Object obj) {
66 if (getClass() != obj.getClass()) {
70 FreeAtHomeHttpCommunicationException other = (FreeAtHomeHttpCommunicationException) obj;
72 return errorCode == other.errorCode && Objects.equals(errorMessage, other.errorMessage);