2 // System.Web.HtmlizedException
5 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
7 // (C) 2003 Ximian, Inc (http://www.ximian.com)
16 internal abstract class HtmlizedException : Exception
18 protected HtmlizedException ()
22 protected HtmlizedException (string message)
27 protected HtmlizedException (string message, Exception inner)
28 : base (message, inner)
32 public abstract string Title { get; }
33 public abstract string Description { get; }
34 public abstract string ErrorMessage { get; }
35 public abstract string FileName { get; }
36 public abstract StringReader SourceError { get; }
37 public abstract int SourceErrorLine { get; }
38 public abstract TextReader SourceFile { get; }
40 public bool HaveSourceError {
41 get { return SourceError != null; }
44 public bool HaveSourceFile {
45 get { return SourceFile != null; }
48 internal static string GetErrorLines (TextReader reader, int line, out int errorLine)
50 int firstLine = (line > 2) ? (line - 2) : line;
51 int lastLine = (line >= 0) ? (firstLine + 2) : Int32.MaxValue;
52 errorLine = (line > 2) ? line : 1;
56 while ((s = reader.ReadLine ()) != null && current != firstLine)
60 return "Cannot read error line.";
62 StringBuilder builder = new StringBuilder ();
64 builder.Append (s + '\n');
66 } while (current < lastLine && (s = reader.ReadLine ()) != null);
68 return builder.ToString ();