Compare commits

...

3 Commits

Author SHA1 Message Date
David Rowe 67ec95bde8 Updated methods for handling LSL script errors, deprecated, and not implemented 2014-01-31 00:20:10 +00:00
Justin Clark-Casey (justincc) b73baeb4a4 Record whether login to home fails because no home set (UUID.Zero) or region not found. 2014-01-30 00:40:56 +00:00
Justin Clark-Casey (justincc) bdab05df0e Add "show grid user" robust/standalone console command for debug purposes.
Shows all data on entries which match or start with a given ID.
This would usually be a UUID.
2014-01-30 00:03:22 +00:00
3 changed files with 113 additions and 14 deletions
@@ -101,7 +101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// </summary>
protected TaskInventoryItem m_item;
protected bool throwErrorOnNotImplemented = true;
protected bool throwErrorOnNotImplemented = false;
protected AsyncCommandManager AsyncCommands = null;
protected float m_ScriptDelayFactor = 1.0f;
protected float m_ScriptDistanceFactor = 1.0f;
@@ -11245,20 +11245,71 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return item.ItemID;
}
internal void ShoutError(string msg)
/// <summary>
/// Reports the script error in the viewer's Script Warning/Error dialog and shouts it on the debug channel.
/// </summary>
/// <param name="command">The name of the command that generated the error.</param>
/// <param name="message">The error message to report to the user.</param>
internal void Error(string command, string message)
{
llShout(ScriptBaseClass.DEBUG_CHANNEL, msg);
string text = command + ": " + message;
if (text.Length > 1023)
{
text = text.Substring(0, 1023);
}
World.SimChat(Utils.StringToBytes(text), ChatTypeEnum.DebugChannel, ScriptBaseClass.DEBUG_CHANNEL,
m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
if (wComm != null)
{
wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, text);
}
}
internal void NotImplemented(string command)
/// <summary>
/// Reports that the command is not implemented as a script error.
/// </summary>
/// <param name="command">The name of the command that is not implemented.</param>
/// <param name="message">Additional information to report to the user. (Optional)</param>
internal void NotImplemented(string command, string message = "")
{
if (throwErrorOnNotImplemented)
throw new NotImplementedException("Command not implemented: " + command);
{
if (message != "")
{
message = " - " + message;
}
throw new NotImplementedException("Command not implemented: " + command + message);
}
else
{
string text = "Command not implemented";
if (message != "")
{
text = text + " - " + message;
}
Error(command, text);
}
}
internal void Deprecated(string command)
/// <summary>
/// Reports that the command is deprecated as a script error.
/// </summary>
/// <param name="command">The name of the command that is deprecated.</param>
/// <param name="message">Additional information to report to the user. (Optional)</param>
internal void Deprecated(string command, string message = "")
{
throw new ScriptException("Command deprecated: " + command);
string text = "Command deprecated";
if (message != "")
{
text = text + " - " + message;
}
Error(command, text);
}
internal void LSLError(string msg)
@@ -382,11 +382,30 @@ namespace OpenSim.Services.LLLoginService
//
GridRegion home = null;
GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString());
if (guinfo != null && (guinfo.HomeRegionID != UUID.Zero) && m_GridService != null)
// We are only going to complain about no home if the user actually tries to login there, to avoid
// spamming the console.
if (guinfo != null)
{
home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID);
if (guinfo.HomeRegionID == UUID.Zero && startLocation == "home")
{
m_log.WarnFormat(
"[LLOGIN SERVICE]: User {0} tried to login to a 'home' start location but they have none set",
account.Name);
}
else if (m_GridService != null)
{
home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID);
if (home == null && startLocation == "home")
{
m_log.WarnFormat(
"[LLOGIN SERVICE]: User {0} tried to login to a 'home' start location with ID {1} but this was not found.",
account.Name, guinfo.HomeRegionID);
}
}
}
if (guinfo == null)
else
{
// something went wrong, make something up, so that we don't have to test this anywhere else
guinfo = new GridUserInfo();
@@ -506,10 +525,6 @@ namespace OpenSim.Services.LLLoginService
if (home == null)
{
m_log.WarnFormat(
"[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set",
account.FirstName, account.LastName);
tryDefaults = true;
}
else
@@ -48,6 +48,14 @@ namespace OpenSim.Services.UserAccountService
{
m_log.Debug("[GRID USER SERVICE]: Starting user grid service");
MainConsole.Instance.Commands.AddCommand(
"Users", false,
"show grid user",
"show grid user <ID>",
"Show grid user entry or entries that match or start with the given ID. This will normally be a UUID.",
"This is for debug purposes to see what data is found for a particular user id.",
HandleShowGridUser);
MainConsole.Instance.Commands.AddCommand(
"Users", false,
"show grid users online",
@@ -58,6 +66,31 @@ namespace OpenSim.Services.UserAccountService
HandleShowGridUsersOnline);
}
protected void HandleShowGridUser(string module, string[] cmdparams)
{
if (cmdparams.Length != 4)
{
MainConsole.Instance.Output("Usage: show grid user <UUID>");
return;
}
GridUserData[] data = m_Database.GetAll(cmdparams[3]);
foreach (GridUserData gu in data)
{
ConsoleDisplayList cdl = new ConsoleDisplayList();
cdl.AddRow("User ID", gu.UserID);
foreach (KeyValuePair<string,string> kvp in gu.Data)
cdl.AddRow(kvp.Key, kvp.Value);
MainConsole.Instance.Output(cdl.ToString());
}
MainConsole.Instance.OutputFormat("Entries: {0}", data.Length);
}
protected void HandleShowGridUsersOnline(string module, string[] cmdparams)
{
// if (cmdparams.Length != 4)