예제 #1
0
파일: XmlBuilder.cs 프로젝트: nobled/mono
		public override void SetTagInnerText (string text)
		{
			string trimmed = text.Trim ();
			if (trimmed == "")
				return;

			XmlDocument doc = new XmlDocument ();
			try {
				doc.LoadXml (text);
			} catch (XmlException xmle) {
				Location newloc = new Location (Location);
				if (xmle.LineNumber >= 0)
					newloc.BeginLine += xmle.LineNumber - 1;

				Location = newloc;
				throw;
			}

			base.AppendLiteralString (trimmed);
		}
예제 #2
0
		Exception GetCompilerError()
		{
			string _errFile = _context.Request.MapPath ("~/" + _session + ".vmwerr");
			
			if (!File.Exists(_errFile))
				throw new FileNotFoundException("Internal Error",_errFile);

			StreamReader sr = new StreamReader(_errFile);
			string message = string.Empty, line = null, file = null, lineInFile = "0";

			while ((line = sr.ReadLine()) != null)
			{
				if (line.StartsWith("Message: "))
					message = line.Substring("Message: ".Length);
				else if (line.StartsWith("File: "))
					file = line.Substring("File: ".Length);
				else if (line.StartsWith("Line: "))
					lineInFile = line.Substring("Line: ".Length);
			}

			sr.Close();

			if (file != null)
			{
				Location loc = new Location(null);
				loc.Filename = file;
				loc.BeginLine = int.Parse(lineInFile);
				return new ParseException(loc,message);
			}

			if (message.IndexOf(typeof(FileNotFoundException).Name) != -1 &&
				message.IndexOf(_url.Trim('\\','/').Replace('/','\\')) != -1)
				message = "The requested resource (" + _url + ") is not available.";
			return new HttpException(404,(message !=  null ? message : string.Empty));
		}