2 * Copyright (c) 2023 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.restconf.common.errors;
10 import com.google.common.util.concurrent.FutureCallback;
11 import org.eclipse.jdt.annotation.NonNull;
14 * A {@link FutureCallback} tied to a {@link RestconfFuture}.
16 * @param <V> value type
18 public abstract class RestconfCallback<V> implements FutureCallback<@NonNull V> {
20 public final void onFailure(final Throwable cause) {
21 onFailure(cause instanceof RestconfDocumentedException rde ? rde
22 : new RestconfDocumentedException("Unexpected failure", cause));
25 protected abstract void onFailure(@NonNull RestconfDocumentedException failure);