| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- //
- // System.Web.Compilation.CompilationException
- //
- // Authors:
- // Gonzalo Paniagua Javier ([email protected])
- //
- // (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
- //
- using System;
- using System.Collections;
- using System.CodeDom.Compiler;
- using System.Text;
- using System.Web;
- namespace System.Web.Compilation
- {
- internal class CompilationException : HtmlizedException
- {
- string filename;
- CompilerErrorCollection errors;
- string fileText;
- string errmsg;
- int [] errorLines;
- public CompilationException (string filename, CompilerErrorCollection errors, string fileText)
- {
- this.filename = filename;
- this.errors = errors;
- this.fileText = fileText;
- }
- public override string SourceFile {
- get {
- if (errors == null || errors.Count == 0)
- return filename;
- return errors [0].FileName;
- }
- }
-
- public override string FileName {
- get { return filename; }
- }
-
- public override string Title {
- get { return "Compilation Error"; }
- }
- public override string Description {
- get {
- return "Error compiling a resource required to service this request. " +
- "Review your source file and modify it to fix this error.";
- }
- }
- public override string ErrorMessage {
- get {
- if (errmsg == null && errors != null) {
- StringBuilder sb = new StringBuilder ();
- foreach (CompilerError err in errors) {
- sb.Append (err);
- sb.Append ("\n");
- }
- errmsg = sb.ToString ();
- }
- return errmsg;
- }
- }
- public override string FileText {
- get { return fileText; }
- }
- public override int [] ErrorLines {
- get {
- if (errorLines == null && errors != null) {
- ArrayList list = new ArrayList ();
- foreach (CompilerError err in errors) {
- if (err.Line != 0)
- list.Add (err.Line);
- }
- errorLines = (int []) list.ToArray (typeof (int));
- Array.Sort (errorLines);
- }
- return errorLines;
- }
- }
- public override bool ErrorLinesPaired {
- get { return false; }
- }
- }
- }
|