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.freebox.internal.api;
15 import org.openhab.binding.freebox.internal.api.model.FreeboxResponse;
18 * Exception for errors when using the Freebox API
20 * @author Laurent Garnier - Initial contribution
22 public class FreeboxException extends Exception {
24 private static final long serialVersionUID = 1L;
26 protected FreeboxResponse<?> response;
28 public FreeboxException(String msg) {
29 this(msg, null, null);
32 public FreeboxException(String msg, Throwable cause) {
33 this(msg, cause, null);
36 public FreeboxException(String msg, FreeboxResponse<?> response) {
37 this(msg, null, response);
40 public FreeboxException(FreeboxResponse<?> response) {
41 this(response.getMsg(), null, response);
44 public FreeboxException(String msg, Throwable cause, FreeboxResponse<?> response) {
46 this.response = response;
49 public FreeboxResponse<?> getResponse() {
53 public boolean isAuthRequired() {
54 return getResponse() != null && getResponse().isAuthRequired();
57 public boolean isMissingRights() {
58 return getResponse() != null && getResponse().isMissingRights();