View Javadoc
1   /*
2    * Copyright (C) 2011 The Guava Authors
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5    * in compliance with the License. You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software distributed under the License
10   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11   * or implied. See the License for the specific language governing permissions and limitations under
12   * the License.
13   */
14  
15  package com.google.common.util.concurrent;
16  
17  import com.google.common.annotations.GwtCompatible;
18  import javax.annotation.Nullable;
19  
20  /**
21   * {@link Error} variant of {@link java.util.concurrent.ExecutionException}. As with {@code
22   * ExecutionException}, the error's {@linkplain #getCause() cause} comes from a failed task,
23   * possibly run in another thread. That cause should itself be an {@code Error}; if not, use {@code
24   * ExecutionException} or {@link UncheckedExecutionException}. This allows the client code to
25   * continue to distinguish between exceptions and errors, even when they come from other threads.
26   *
27   * @author Chris Povirk
28   * @since 10.0
29   */
30  @GwtCompatible
31  public class ExecutionError extends Error {
32    /**
33     * Creates a new instance with {@code null} as its detail message.
34     */
35    protected ExecutionError() {}
36  
37    /**
38     * Creates a new instance with the given detail message.
39     */
40    protected ExecutionError(@Nullable String message) {
41      super(message);
42    }
43  
44    /**
45     * Creates a new instance with the given detail message and cause.
46     */
47    public ExecutionError(@Nullable String message, @Nullable Error cause) {
48      super(message, cause);
49    }
50  
51    /**
52     * Creates a new instance with the given cause.
53     */
54    public ExecutionError(@Nullable Error cause) {
55      super(cause);
56    }
57  
58    private static final long serialVersionUID = 0;
59  }