passing in the function name to MOD_Api.ConvertFromLSL for more user-friendly error messages

connector_plugin
SignpostMarv 2012-09-10 12:18:40 +01:00 committed by Melanie
parent bf56b30024
commit 8db5d79f4b
1 changed files with 4 additions and 4 deletions

View File

@ -254,7 +254,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
object[] convertedParms = new object[parms.Length]; object[] convertedParms = new object[parms.Length];
for (int i = 0; i < parms.Length; i++) for (int i = 0; i < parms.Length; i++)
convertedParms[i] = ConvertFromLSL(parms[i],signature[i]); convertedParms[i] = ConvertFromLSL(parms[i],signature[i], fname);
// now call the function, the contract with the function is that it will always return // now call the function, the contract with the function is that it will always return
// non-null but don't trust it completely // non-null but don't trust it completely
@ -294,7 +294,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <summary> /// <summary>
/// </summary> /// </summary>
protected object ConvertFromLSL(object lslparm, Type type) protected object ConvertFromLSL(object lslparm, Type type, string fname)
{ {
// ---------- String ---------- // ---------- String ----------
if (lslparm is LSL_String) if (lslparm is LSL_String)
@ -374,14 +374,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
(LSL_Vector)plist[i]); (LSL_Vector)plist[i]);
} }
else else
MODError("unknown LSL list element type"); MODError(String.Format("{0}: unknown LSL list element type", fname));
} }
return result; return result;
} }
} }
MODError(String.Format("parameter type mismatch; expecting {0}",type.Name)); MODError(String.Format("{1}: parameter type mismatch; expecting {0}",type.Name, fname));
return null; return null;
} }