1. /*
  2. * @(#)Error.java 1.16 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.lang;
  8. /**
  9. * An <code>Error</code> is a subclass of <code>Throwable</code>
  10. * that indicates serious problems that a reasonable application
  11. * should not try to catch. Most such errors are abnormal conditions.
  12. * The <code>ThreadDeath</code> error, though a "normal" condition,
  13. * is also a subclass of <code>Error</code> because most applications
  14. * should not try to catch it.
  15. * <p>
  16. * A method is not required to declare in its <code>throws</code>
  17. * clause any subclasses of <code>Error</code> that might be thrown
  18. * during the execution of the method but not caught, since these
  19. * errors are abnormal conditions that should never occur.
  20. *
  21. * @author Frank Yellin
  22. * @version 1.16, 12/19/03
  23. * @see java.lang.ThreadDeath
  24. * @since JDK1.0
  25. */
  26. public class Error extends Throwable {
  27. static final long serialVersionUID = 4980196508277280342L;
  28. /**
  29. * Constructs a new error with <code>null</code> as its detail message.
  30. * The cause is not initialized, and may subsequently be initialized by a
  31. * call to {@link #initCause}.
  32. */
  33. public Error() {
  34. super();
  35. }
  36. /**
  37. * Constructs a new error with the specified detail message. The
  38. * cause is not initialized, and may subsequently be initialized by
  39. * a call to {@link #initCause}.
  40. *
  41. * @param message the detail message. The detail message is saved for
  42. * later retrieval by the {@link #getMessage()} method.
  43. */
  44. public Error(String message) {
  45. super(message);
  46. }
  47. /**
  48. * Constructs a new error with the specified detail message and
  49. * cause. <p>Note that the detail message associated with
  50. * <code>cause</code> is <i>not</i> automatically incorporated in
  51. * this error's detail message.
  52. *
  53. * @param message the detail message (which is saved for later retrieval
  54. * by the {@link #getMessage()} method).
  55. * @param cause the cause (which is saved for later retrieval by the
  56. * {@link #getCause()} method). (A <tt>null</tt> value is
  57. * permitted, and indicates that the cause is nonexistent or
  58. * unknown.)
  59. * @since 1.4
  60. */
  61. public Error(String message, Throwable cause) {
  62. super(message, cause);
  63. }
  64. /**
  65. * Constructs a new error with the specified cause and a detail
  66. * message of <tt>(cause==null ? null : cause.toString())</tt> (which
  67. * typically contains the class and detail message of <tt>cause</tt>).
  68. * This constructor is useful for errors that are little more than
  69. * wrappers for other throwables.
  70. *
  71. * @param cause the cause (which is saved for later retrieval by the
  72. * {@link #getCause()} method). (A <tt>null</tt> value is
  73. * permitted, and indicates that the cause is nonexistent or
  74. * unknown.)
  75. * @since 1.4
  76. */
  77. public Error(Throwable cause) {
  78. super(cause);
  79. }
  80. }