]> git.basschouten.com Git - openhab-addons.git/blob
7f68085c225b354039143c68c31b588675fd0470
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.plugwise.internal.protocol;
14
15 import java.util.regex.Pattern;
16
17 import org.openhab.binding.plugwise.internal.protocol.field.MessageType;
18
19 /**
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.
22  *
23  * @author Wouter Born - Initial contribution
24  */
25 public class PlugwisePayloadMismatchException extends RuntimeException {
26
27     private static final long serialVersionUID = 1160553788698072410L;
28
29     public PlugwisePayloadMismatchException(MessageType messageType, Pattern pattern0, Pattern pattern1,
30             String payload) {
31         super(String.format("Plugwise %s payload mismatch: %s does not match %s or %s", messageType.name(), payload,
32                 pattern0.pattern(), pattern1.pattern()));
33     }
34
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,
37                 pattern.pattern()));
38     }
39 }