1 /*
2 * Copyright 2006-2016 The JGUIraffe Team.
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 package net.sf.jguiraffe.gui.builder;
17
18 import java.net.URL;
19
20 /**
21 * <p>
22 * An exception class for reporting error conditions related to the GUI builder.
23 * </p>
24 * <p>
25 * As an additional property this exception class stores the URL of the script
26 * that caused the error.
27 * </p>
28 *
29 * @author Oliver Heger
30 * @version $Id: BuilderException.java 205 2012-01-29 18:29:57Z oheger $
31 */
32 public class BuilderException extends Exception
33 {
34 /**
35 * The serial version UID.
36 */
37 private static final long serialVersionUID = -2511636810150042168L;
38
39 /** Stores the URL of the failing script. */
40 private URL scriptURL;
41
42 /**
43 * Creates a new instance of <code>BuilderException</code> and sets the
44 * error message.
45 *
46 * @param msg the error message
47 */
48 public BuilderException(String msg)
49 {
50 super(msg);
51 }
52
53 /**
54 * Creates a new instance of <code>BuilderException</code> and sets the
55 * script URL and the root cause.
56 *
57 * @param script the URL of the script
58 * @param cause the root cause
59 */
60 public BuilderException(URL script, Throwable cause)
61 {
62 super(cause);
63 scriptURL = script;
64 }
65
66 /**
67 * Creates a new instance of <code>BuilderException</code> and sets the
68 * script URL, the root cause, and an additional message.
69 *
70 * @param script the script URL
71 * @param msg the error message
72 * @param cause the root cause
73 */
74 public BuilderException(URL script, String msg, Throwable cause)
75 {
76 super(msg, cause);
77 scriptURL = script;
78 }
79
80 /**
81 * Returns the URL of the failing script.
82 *
83 * @return the URL of the script
84 */
85 public URL getScriptURL()
86 {
87 return scriptURL;
88 }
89 }