Patched up error handling to return a better XML string.

Sugilite
Adam Frisby 2007-06-09 01:31:59 +00:00
parent 0a600b2dbf
commit 86a3b586f8
1 changed files with 19 additions and 1 deletions

View File

@ -657,7 +657,25 @@ namespace OpenGridServices.UserServer
public string CreateUnknownUserErrorResponse() public string CreateUnknownUserErrorResponse()
{ {
return "<error>Unknown user</error>"; System.IO.StringWriter sw = new System.IO.StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw);
// Header
xw.Formatting = Formatting.Indented;
xw.WriteStartDocument();
xw.WriteDocType("error", null, null, null);
xw.WriteComment("An error occured");
xw.WriteStartElement("error");
// User
xw.WriteElementString("unknownuser", "Unable to find a user with that name");
// Footer
xw.WriteEndElement();
xw.Flush();
xw.Close();
return sw.ToString();
} }
/// <summary> /// <summary>