001/*
002 * Copyright (C) 2011 The Guava Authors
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package com.google.common.util.concurrent;
018
019import com.google.common.annotations.GwtCompatible;
020
021import javax.annotation.Nullable;
022
023/**
024 * {@link Error} variant of {@link java.util.concurrent.ExecutionException}. As
025 * with {@code ExecutionException}, the error's {@linkplain #getCause() cause}
026 * comes from a failed task, possibly run in another thread. That cause should
027 * itself be an {@code Error}; if not, use {@code ExecutionException} or {@link
028 * UncheckedExecutionException}. This allows the client code to continue to
029 * distinguish between exceptions and errors, even when they come from other
030 * threads.
031 *
032 * @author Chris Povirk
033 * @since 10.0
034 */
035@GwtCompatible
036public class ExecutionError extends Error {
037  /**
038   * Creates a new instance with {@code null} as its detail message.
039   */
040  protected ExecutionError() {}
041
042  /**
043   * Creates a new instance with the given detail message.
044   */
045  protected ExecutionError(@Nullable String message) {
046    super(message);
047  }
048
049  /**
050   * Creates a new instance with the given detail message and cause.
051   */
052  public ExecutionError(@Nullable String message, @Nullable Error cause) {
053    super(message, cause);
054  }
055
056  /**
057   * Creates a new instance with the given cause.
058   */
059  public ExecutionError(@Nullable Error cause) {
060    super(cause);
061  }
062
063  private static final long serialVersionUID = 0;
064}