2
// System.Web.Compilation.ParseException
5
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
7
// (C) 2003 Ximian, Inc (http://www.ximian.com)
11
// Permission is hereby granted, free of charge, to any person obtaining
12
// a copy of this software and associated documentation files (the
13
// "Software"), to deal in the Software without restriction, including
14
// without limitation the rights to use, copy, modify, merge, publish,
15
// distribute, sublicense, and/or sell copies of the Software, and to
16
// permit persons to whom the Software is furnished to do so, subject to
17
// the following conditions:
19
// The above copyright notice and this permission notice shall be
20
// included in all copies or substantial portions of the Software.
22
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
using MonoDevelop.AspNet.Parser.Dom;
35
namespace MonoDevelop.AspNet.Parser.Internal
37
public class ParseException : HtmlizedException
42
public ParseException (ILocation location, string message)
43
: this (location, message, null)
48
public ParseException (ILocation location, string message, Exception inner)
49
: base (message, inner)
51
this.location = new Location (location);
54
public override string Title {
55
get { return "Parser Error"; }
58
public override string Description {
60
return "Error parsing a resource required to service this request. " +
61
"Review your source file and modify it to fix this error.";
65
public ILocation Location {
66
get { return location; }
69
public override string ErrorMessage {
70
get { return Message; }
73
public override string SourceFile {
74
get { return FileName; }
77
public override string FileName {
82
return location.Filename;
86
public override string FileText {
91
string text = location != null ? location.FileText : null;
92
if (text != null && text.Length > 0)
99
using (TextReader reader = new StreamReader (FileName))
100
fileText = reader.ReadToEnd ();
105
public override int [] ErrorLines {
107
if (location == null)
110
return new int [] {location.BeginLine, location.EndLine};
114
public override bool ErrorLinesPaired {
119
public abstract class HtmlizedException : Exception
121
protected HtmlizedException ()
125
protected HtmlizedException (string message)
130
protected HtmlizedException (string message, Exception inner)
131
: base (message, inner)
135
public abstract string Title { get; }
136
public abstract string Description { get; }
137
public abstract string ErrorMessage { get; }
138
public abstract string FileName { get; }
139
public abstract string SourceFile { get; }
140
public abstract string FileText { get; }
141
public abstract int [] ErrorLines { get; }
142
public abstract bool ErrorLinesPaired { get; }