* HtmlizedException.cs: simplified to cope with the new interface.
* HttpApplicationFactory.cs: use the application file parser to get the
application Type.
* HttpException.cs: small changes. Needs some more work on
ParseExceptions.
svn path=/trunk/mcs/; revision=14139
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlizedException.cs: simplified to cope with the new interface.
+
+ * HttpApplicationFactory.cs: use the application file parser to get the
+ application Type.
+
+ * HttpException.cs: small changes. Needs some more work on
+ ParseExceptions.
+
2003-03-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* HttpRequest.cs: fixed Url property.
public abstract string Description { get; }
public abstract string ErrorMessage { get; }
public abstract string FileName { get; }
- public abstract StringReader SourceError { get; }
- public abstract int SourceErrorLine { get; }
- public abstract TextReader SourceFile { get; }
-
- public bool HaveSourceError {
- get { return SourceError != null; }
- }
-
- public bool HaveSourceFile {
- get { return SourceFile != null; }
- }
-
- internal static string GetErrorLines (TextReader reader, int line, out int errorLine)
- {
- int firstLine = (line > 2) ? (line - 2) : line;
- int lastLine = (line >= 0) ? (firstLine + 2) : Int32.MaxValue;
- errorLine = (line > 2) ? line : 1;
- int current = 0;
- string s;
-
- while ((s = reader.ReadLine ()) != null && current != firstLine)
- current++;
-
- if (s == null)
- return "Cannot read error line.";
-
- StringBuilder builder = new StringBuilder ();
- do {
- builder.Append (s + '\n');
- current++;
- } while (current < lastLine && (s = reader.ReadLine ()) != null);
-
- return builder.ToString ();
- }
}
}
using System.Collections;\r
using System.IO;\r
using System.Reflection;\r
-using System.Web;\r
+using System.Web.UI;\r
using System.Web.Compilation;\r
using System.Web.SessionState;\r
\r
if (File.Exists(_appFilename)) {\r
// Setup filemonitor for all filedepend also. CacheDependency?\r
\r
- _appType = GlobalAsaxCompiler.CompileApplicationType (_appFilename, context);\r
+ _appType = ApplicationFileParser.GetCompiledApplicationType (_appFilename, context);\r
if (_appType == null) {\r
string msg = String.Format ("Error compiling application file ({0}).", _appFilename);\r
throw new ApplicationException (msg);\r
{\r
custApplication = customApplication;\r
}\r
+\r
+ internal Type AppType {\r
+ get { return _appType; }\r
+ }\r
}\r
}\r
using System;
using System.IO;
using System.Text;
-//using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using System.Web.Compilation;
using System.Web.Util;
namespace System.Web
static string HtmlEncode (string s)
{
- return HttpUtility.HtmlEncode (s);
+ string res = HttpUtility.HtmlEncode (s);
+ return res.Replace ("\n", "<br />");
}
string GetHtmlizedErrorMessage ()
builder.AppendFormat ("<b>Description: </b>{0}\n<p>\n", HtmlEncode (exc.Description));
builder.AppendFormat ("<b>Error message: </b>{0}\n<p>\n", HtmlEncode (exc.ErrorMessage));
+ if (exc is ParseException)
+ builder.Append ("<b>File name: </b>" + exc.FileName);
+ else if (exc is CompilationException) {
+ builder.Append ("<table summary=\"Source file\" width=\"100%\" bgcolor=\"#ffffc\">\n<tr><td>");
+ FormatReader (builder, ((CompilationException) exc).File, 0);
+ builder.Append ("</td></tr>\n</table>\n<p>\n");
+ }
+ /*
if (exc.HaveSourceError) {
builder.Append ("<b>Source Error: </b>\n<p>\n");
builder.Append ("<table summary=\"Source error\" width=\"100%\" bgcolor=\"#ffffc\">\n<tr><td>");
builder.Append ("</td></tr>\n</table>\n<p>\n");
}
-
+ */
builder.Append ("<hr>\n</body>\n</html>\n");
builder.AppendFormat ("<!--\n{0}\n-->\n", HtmlEncode (exc.ToString ()));
return builder.ToString ();
}
+ static void FormatReader (StringBuilder builder, string text, int errorLine)
+ {
+ FormatReader (builder, new StringReader (text), errorLine, true);
+ }
+
static void FormatReader (StringBuilder builder, TextReader reader, int errorLine)
{
FormatReader (builder, reader, errorLine, true);