2 // System.Web.Compilation.CompilationException
5 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
7 // (C) 2002,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.
32 using System.Collections;
33 using System.CodeDom.Compiler;
37 namespace System.Web.Compilation
39 internal class CompilationException : HtmlizedException
42 CompilerErrorCollection errors;
47 public CompilationException (string filename, CompilerErrorCollection errors, string fileText)
49 this.filename = filename;
51 this.fileText = fileText;
54 public override string SourceFile {
56 if (errors == null || errors.Count == 0)
59 return errors [0].FileName;
63 public override string FileName {
64 get { return filename; }
67 public override string Title {
68 get { return "Compilation Error"; }
71 public override string Description {
73 return "Error compiling a resource required to service this request. " +
74 "Review your source file and modify it to fix this error.";
78 public override string ErrorMessage {
80 if (errmsg == null && errors != null) {
81 StringBuilder sb = new StringBuilder ();
82 foreach (CompilerError err in errors) {
86 errmsg = sb.ToString ();
93 public override string FileText {
94 get { return fileText; }
97 public override int [] ErrorLines {
99 if (errorLines == null && errors != null) {
100 ArrayList list = new ArrayList ();
101 foreach (CompilerError err in errors) {
102 if (err.Line != 0 && !list.Contains (err.Line))
105 errorLines = (int []) list.ToArray (typeof (int));
106 Array.Sort (errorLines);
113 public override bool ErrorLinesPaired {
114 get { return false; }