2 * Copyright (c) 2010-2020 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.automower.internal.rest.exceptions;
15 import java.io.IOException;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * An exception that occurred while communicating with an automower or an automower bridge
22 * @author Markus Pfleger - Initial contribution
25 public class AutomowerCommunicationException extends IOException {
26 private static final long serialVersionUID = 1L;
27 private int statusCode = -1;
29 public AutomowerCommunicationException(Exception e) {
33 public AutomowerCommunicationException(int statusCode, Exception e) {
35 this.statusCode = statusCode;
38 public AutomowerCommunicationException(int statusCode) {
39 this.statusCode = statusCode;
42 public AutomowerCommunicationException(int statusCode, String message) {
44 this.statusCode = statusCode;
47 public AutomowerCommunicationException(String message, Exception e) {
51 public AutomowerCommunicationException(String message) {
55 public int getStatusCode() {
60 public String getMessage() {
61 return "Rest call failed: statusCode=" + statusCode + ", message=" + super.getMessage();
65 public String toString() {
66 return getClass().getSimpleName() + ": statusCode=" + statusCode + ", message=" + super.getMessage()
67 + ", cause: " + getCause();