1 /* 2 * Copyright (C) 2011 The Guava Authors 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 package com.google.common.util.concurrent; 18 19 import com.google.common.annotations.GwtCompatible; 20 import com.google.common.annotations.Beta; 21 22 /** 23 * {@link Error} variant of {@link java.util.concurrent.ExecutionException}. As 24 * with {@code ExecutionException}, the error's {@linkplain #getCause() cause} 25 * comes from a failed task, possibly run in another thread. That cause should 26 * itself be an {@code Error}; if not, use {@code ExecutionException} or {@link 27 * UncheckedExecutionException}. This allows the client code to continue to 28 * distinguish between exceptions and errors, even when they come from other 29 * threads. 30 * 31 * @author Chris Povirk 32 * @since 10.0 33 */ 34 @Beta 35 @GwtCompatible 36 public class ExecutionError extends Error { 37 /** 38 * Creates a new instance with {@code null} as its detail message. 39 */ 40 protected ExecutionError() {} 41 42 /** 43 * Creates a new instance with the given detail message. 44 */ 45 protected ExecutionError(String message) { 46 super(message); 47 } 48 49 /** 50 * Creates a new instance with the given detail message and cause. 51 */ 52 public ExecutionError(String message, Error cause) { 53 super(message, cause); 54 } 55 56 /** 57 * Creates a new instance with the given cause. 58 */ 59 public ExecutionError(Error cause) { 60 super(cause); 61 } 62 63 private static final long serialVersionUID = 0; 64 } 65