]> git.basschouten.com Git - openhab-addons.git/blob
975dacf931e172f2986547dc49bfcbbf3792868b
[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.heos.internal.json.dto;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * Error object for containing information about HEOS errors
20  *
21  * @author Martin van Wingerden - Initial contribution
22  */
23 @NonNullByDefault
24 public class HeosError {
25     public final HeosErrorCode code;
26     private final @Nullable Long systemErrorNumber;
27
28     HeosError(@Nullable Long errorCode, @Nullable Long systemErrorNumber) {
29         if (errorCode == null) {
30             throw new IllegalArgumentException("Error code not given");
31         }
32         this.code = HeosErrorCode.of(errorCode);
33         this.systemErrorNumber = systemErrorNumber;
34     }
35
36     @Override
37     public String toString() {
38         return "HeosError{" + "code=" + code + ", systemErrorNumber=" + systemErrorNumber + '}';
39     }
40 }