From eb5c508f8b396ea65d5d80c763aaea70a46c4653 Mon Sep 17 00:00:00 2001 From: meta7 Date: Mon, 9 Aug 2010 23:35:40 -0700 Subject: Add a DebuggerSafe option to the ini to help with debugging in visual studio. This essentially silences exceptions in the script engine. Disabled by default, naturally. --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++++-- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 11 ++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 68b645e..71d63bb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -100,6 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected int m_notecardLineReadCharsMax = 255; protected int m_scriptConsoleChannel = 0; protected bool m_scriptConsoleChannelEnabled = false; + protected bool m_debuggerSafe = false; protected IUrlModule m_UrlModule = null; protected Dictionary m_userInfoCache = new Dictionary(); @@ -110,6 +111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host = host; m_localID = localID; m_itemID = itemID; + m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); m_ScriptDelayFactor = m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); @@ -3220,13 +3222,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return m_host.OwnerID.ToString(); } - [DebuggerNonUserCode] public void llInstantMessage(string user, string message) { UUID result; if (!UUID.TryParse(user, out result)) { - throw new Exception(String.Format("An invalid key of '{0} was passed to llInstantMessage", user)); + if (!m_debuggerSafe) + { + throw new Exception(String.Format("An invalid key of '{0} was passed to llInstantMessage", user)); + } return; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 80b021f..73e87b5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -129,6 +129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; internal float m_ScriptDelayFactor = 1.0f; internal float m_ScriptDistanceFactor = 1.0f; + internal bool m_debuggerSafe = false; internal Dictionary m_FunctionPerms = new Dictionary(); public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) @@ -137,6 +138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host = host; m_localID = localID; m_itemID = itemID; + m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) m_OSFunctionsEnabled = true; @@ -195,7 +197,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal void OSSLError(string msg) { - throw new Exception("OSSL Runtime Error: " + msg); + if (m_debuggerSafe) + { + OSSLShoutError(msg); + } + else + { + throw new Exception("OSSL Runtime Error: " + msg); + } } private void InitLSL() -- cgit v1.1