diff options
author | Robert Adams | 2013-08-08 08:56:22 -0700 |
---|---|---|
committer | Robert Adams | 2013-08-08 09:45:16 -0700 |
commit | c67c55e0fcd93e5b68e61e5f1bc4341af48568d3 (patch) | |
tree | cea426c12faaa9d502043f32e59ec5ff0fdde4c1 /OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | |
parent | Add a JSON web fetch of the statististics managed by StatsManager. (diff) | |
download | opensim-SC_OLD-c67c55e0fcd93e5b68e61e5f1bc4341af48568d3.zip opensim-SC_OLD-c67c55e0fcd93e5b68e61e5f1bc4341af48568d3.tar.gz opensim-SC_OLD-c67c55e0fcd93e5b68e61e5f1bc4341af48568d3.tar.bz2 opensim-SC_OLD-c67c55e0fcd93e5b68e61e5f1bc4341af48568d3.tar.xz |
Better error reporting when registering LSL function extensions (comms module).
For unknown reasons, a dynamic function signature cannot have more than 5
parameters. Error message now tells you this fact so you can curse MS and
then go change your function definitions.
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index a515346..6da2222 100644 --- a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | |||
@@ -45,6 +45,7 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms | |||
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | private static string LogHeader = "[MODULE COMMS]"; | ||
48 | 49 | ||
49 | private Dictionary<string,object> m_constants = new Dictionary<string,object>(); | 50 | private Dictionary<string,object> m_constants = new Dictionary<string,object>(); |
50 | 51 | ||
@@ -148,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms | |||
148 | MethodInfo mi = GetMethodInfoFromType(target.GetType(), meth, true); | 149 | MethodInfo mi = GetMethodInfoFromType(target.GetType(), meth, true); |
149 | if (mi == null) | 150 | if (mi == null) |
150 | { | 151 | { |
151 | m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", meth); | 152 | m_log.WarnFormat("{0} Failed to register method {1}", LogHeader, meth); |
152 | return; | 153 | return; |
153 | } | 154 | } |
154 | 155 | ||
@@ -165,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms | |||
165 | { | 166 | { |
166 | // m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, (target is Type) ? ((Type)target).Name : target.GetType().Name); | 167 | // m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, (target is Type) ? ((Type)target).Name : target.GetType().Name); |
167 | 168 | ||
168 | Type delegateType; | 169 | Type delegateType = typeof(void); |
169 | List<Type> typeArgs = mi.GetParameters() | 170 | List<Type> typeArgs = mi.GetParameters() |
170 | .Select(p => p.ParameterType) | 171 | .Select(p => p.ParameterType) |
171 | .ToList(); | 172 | .ToList(); |
@@ -176,8 +177,16 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms | |||
176 | } | 177 | } |
177 | else | 178 | else |
178 | { | 179 | { |
179 | typeArgs.Add(mi.ReturnType); | 180 | try |
180 | delegateType = Expression.GetFuncType(typeArgs.ToArray()); | 181 | { |
182 | typeArgs.Add(mi.ReturnType); | ||
183 | delegateType = Expression.GetFuncType(typeArgs.ToArray()); | ||
184 | } | ||
185 | catch (Exception e) | ||
186 | { | ||
187 | m_log.ErrorFormat("{0} Failed to create function signature. Most likely more than 5 parameters. Method={1}. Error={2}", | ||
188 | LogHeader, mi.Name, e); | ||
189 | } | ||
181 | } | 190 | } |
182 | 191 | ||
183 | Delegate fcall; | 192 | Delegate fcall; |