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.plugwise.internal.protocol;
15 import java.util.regex.Pattern;
17 import org.openhab.binding.plugwise.internal.protocol.field.MessageType;
20 * The payload of a message does not match the expected message pattern. Thrown whenever the payload of a received
21 * message could not be parsed.
23 * @author Wouter Born - Initial contribution
25 public class PlugwisePayloadMismatchException extends RuntimeException {
27 private static final long serialVersionUID = 1160553788698072410L;
29 public PlugwisePayloadMismatchException(MessageType messageType, Pattern pattern0, Pattern pattern1,
31 super(String.format("Plugwise %s payload mismatch: %s does not match %s or %s", messageType.name(), payload,
32 pattern0.pattern(), pattern1.pattern()));
35 public PlugwisePayloadMismatchException(MessageType messageType, Pattern pattern, String payload) {
36 super(String.format("Plugwise %s payload mismatch: %s does not match %s", messageType.name(), payload,