summaryrefslogtreecommitdiff
path: root/src/library/scala/xml/include/XIncludeException.scala
blob: 5563d68c382faa1854f97a52fa9c407fca8d39b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2002-2007, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

// $Id$

package scala.xml.include

/**
 * <p>
 * <code>XIncludeException</code> is the generic superclass
 * for all checked exceptions that may be thrown as a result
 * of a violation of XInclude's rules.
 * </p>
 * <p>
 * Constructs an <code>XIncludeException</code> with the specified detail
 * message. The error message string <code>message</code> can later be
 * retrieved by the <code>{@link java.lang.Throwable#getMessage}</code>
 * method of class <code>java.lang.Throwable</code>.
 * </p>
 *
 * @param   message   the detail message.
 */
class XIncludeException(message: String) extends Exception(message) {

  /**
   * uses <code>null</code> as its error detail message.
   */
  def this() = this(null)

  private var rootCause: Throwable = null

  /**
   * When an <code>IOException</code>, <code>MalformedURLException</code>
   * or other generic exception is thrown while processing an XML document
   * for XIncludes, it is customarily replaced
   * by some form of <code>XIncludeException</code>.
   * This method allows you to store the original exception.
   *
   * @param   nestedException   the underlying exception which
   caused the XIncludeException to be thrown
   */
  def setRootCause(nestedException: Throwable ) {
    this.rootCause = nestedException
  }

  /**
   * When an <code>IOException</code>, <code>MalformedURLException</code>
   * or other generic exception is thrown while processing an XML document
   * for XIncludes, it is customarily replaced
   * by some form of <code>XIncludeException</code>.
   * This method allows you to retrieve the original exception.
   * It returns null if no such exception caused this <code>XIncludeException</code>.
   *
   * @return Throwable   the underlying exception which caused the
   *                     <code>XIncludeException</code> to be thrown
   */
  def getRootCause(): Throwable = this.rootCause

}