1 // NAnt - A .NET build tool
2 // Copyright (C) 2001 Gerry Shaw
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // Gerry Shaw (gerry_shaw@yahoo.com)
19 // Ian MacLean (ian_maclean@another.com)
21 namespace SourceForge
.NAnt
{
26 /// Thrown whenever an error occurs during the build.
28 public class BuildException
: ApplicationException
{
30 private Location _location
= Location
.UnknownLocation
;
33 /// Constructs a build exception with no descriptive information.
35 public BuildException() : base() {
39 /// Constructs an exception with a descriptive message.
41 public BuildException(String message
) : base(message
) {
45 /// Constructs an exception with a descriptive message and an
46 /// instance of the Exception that is the cause of the current Exception.
48 public BuildException(String message
, Exception e
) : base(message
, e
) {
52 /// Constructs an exception with a descriptive message and location
53 /// in the build file that caused the exception.
55 /// <param name="location">Location in the build file where the exception occured.</param>
56 public BuildException(String message
, Location location
) : base(message
) {
61 /// Constructs an exception with the given descriptive message, the
62 /// location in the build file and an instance of the Exception that
63 /// is the cause of the current Exception.
65 /// <param name="message">The error message that explains the reason for the exception.</param>
66 /// <param name="location">Location in the build file where the exception occured.</param>
67 /// <param name="e">An instance of Exception that is the cause of the current Exception.</param>
68 public BuildException(String message
, Location location
, Exception e
) : base(message
, e
) {
72 public override string Message
{
74 string message
= base.Message
;
76 // only include location string if not empty
77 string locationString
= _location
.ToString();
78 if (locationString
!= String
.Empty
) {
79 message
= locationString
+ " " + message
;