• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Licensed to the Apache Software Foundation (ASF) under one or more
3  *  contributor license agreements.  See the NOTICE file distributed with
4  *  this work for additional information regarding copyright ownership.
5  *  The ASF licenses this file to You under the Apache License, Version 2.0
6  *  (the "License"); you may not use this file except in compliance with
7  *  the License.  You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  */
17 
18 package java.lang;
19 
20 
21 /**
22  * {@code Error} is the superclass of all classes that represent unrecoverable
23  * errors. When errors are thrown, they should not be caught by application
24  * code.
25  *
26  * @see Throwable
27  * @see Exception
28  * @see RuntimeException
29  */
30 public class Error extends Throwable {
31 
32     private static final long serialVersionUID = 4980196508277280342L;
33 
34     /**
35      * Constructs a new {@code Error} that includes the current stack trace.
36      */
Error()37     public Error() {
38         super();
39     }
40 
41     /**
42      * Constructs a new {@code Error} with the current stack trace and the
43      * specified detail message.
44      *
45      * @param detailMessage
46      *            the detail message for this error.
47      */
Error(String detailMessage)48     public Error(String detailMessage) {
49         super(detailMessage);
50     }
51 
52     /**
53      * Constructs a new {@code Error} with the current stack trace, the
54      * specified detail message and the specified cause.
55      *
56      * @param detailMessage
57      *            the detail message for this error.
58      * @param throwable
59      *            the cause of this error.
60      */
Error(String detailMessage, Throwable throwable)61     public Error(String detailMessage, Throwable throwable) {
62         super(detailMessage, throwable);
63     }
64 
65     /**
66      * Constructs a new {@code Error} with the current stack trace and the
67      * specified cause.
68      *
69      * @param throwable
70      *            the cause of this error.
71      */
Error(Throwable throwable)72     public Error(Throwable throwable) {
73         super(throwable);
74     }
75 }
76