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 017 package com.google.common.util.concurrent; 018 019 import com.google.common.annotations.Beta; 020 021 /** 022 * {@link Error} variant of {@link java.util.concurrent.ExecutionException}. As 023 * with {@code ExecutionException}, the error's {@linkplain #getCause() cause} 024 * comes from a failed task, possibly run in another thread. That cause should 025 * itself be an {@code Error}; if not, use {@code ExecutionException} or {@link 026 * UncheckedExecutionException}. This allows the client code to continue to 027 * distinguish between exceptions and errors, even when they come from other 028 * threads. 029 * 030 * @author Chris Povirk 031 * @since 10.0 032 */ 033 @Beta 034 public class ExecutionError extends Error { 035 /** 036 * Creates a new instance with {@code null} as its detail message. 037 */ 038 protected ExecutionError() {} 039 040 /** 041 * Creates a new instance with the given detail message. 042 */ 043 protected ExecutionError(String message) { 044 super(message); 045 } 046 047 /** 048 * Creates a new instance with the given detail message and cause. 049 */ 050 public ExecutionError(String message, Error cause) { 051 super(message, cause); 052 } 053 054 /** 055 * Creates a new instance with the given cause. 056 */ 057 public ExecutionError(Error cause) { 058 super(cause); 059 } 060 061 private static final long serialVersionUID = 0; 062 }