2 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.honeycomb.translate.read;
19 import static com.google.common.base.Preconditions.checkNotNull;
21 import io.fd.honeycomb.translate.TranslationException;
22 import javax.annotation.Nonnull;
23 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
26 * Thrown when a reader or customizer is not able to read data for the given id.
28 public class ReadFailedException extends TranslationException {
30 private final InstanceIdentifier<?> failedId;
33 * Constructs an ReadFailedException given data id and exception cause.
35 * @param failedId instance identifier of the data object that could not be read
36 * @param cause the cause of read failure
38 public ReadFailedException(@Nonnull final InstanceIdentifier<?> failedId, final Throwable cause) {
39 this("Failed to read: ", failedId, cause);
42 protected ReadFailedException(@Nonnull final String msgPrefix,
43 @Nonnull final InstanceIdentifier<?> failedId,
44 @Nonnull final Throwable cause) {
45 super(msgPrefix + failedId, cause);
46 this.failedId = checkNotNull(failedId, "failedId should not be null");
50 * Constructs an ReadFailedException given data id.
52 * @param failedId instance identifier of the data object that could not be read
54 public ReadFailedException(@Nonnull final InstanceIdentifier<?> failedId) {
59 * Returns id of the data object that could not be read.
61 * @return data object instance identifier
64 public InstanceIdentifier<?> getFailedId() {