attempt to handle InvalidCastException in a manner similar to Second Life
parent
3ad827174e
commit
74f5253a36
|
@ -7674,6 +7674,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (InvalidCastException e)
|
||||||
|
{
|
||||||
|
ShoutError(e.Message);
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (positionChanged)
|
if (positionChanged)
|
||||||
|
|
|
@ -560,12 +560,23 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
else if (m_data[itemIndex] is LSL_Types.LSLString)
|
else if (m_data[itemIndex] is LSL_Types.LSLString)
|
||||||
return new LSLInteger(m_data[itemIndex].ToString());
|
return new LSLInteger(m_data[itemIndex].ToString());
|
||||||
else
|
else
|
||||||
throw new InvalidCastException();
|
throw new InvalidCastException(string.Format(
|
||||||
|
"{0} expected but {1} given",
|
||||||
|
typeof(LSL_Types.LSLInteger).Name,
|
||||||
|
m_data[itemIndex] != null ?
|
||||||
|
m_data[itemIndex].GetType().Name : "null"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Types.Vector3 GetVector3Item(int itemIndex)
|
public LSL_Types.Vector3 GetVector3Item(int itemIndex)
|
||||||
{
|
{
|
||||||
|
if(m_data[itemIndex] is LSL_Types.Vector3)
|
||||||
return (LSL_Types.Vector3)m_data[itemIndex];
|
return (LSL_Types.Vector3)m_data[itemIndex];
|
||||||
|
else
|
||||||
|
throw new InvalidCastException(string.Format(
|
||||||
|
"{0} expected but {1} given",
|
||||||
|
typeof(LSL_Types.Vector3).Name,
|
||||||
|
m_data[itemIndex] != null ?
|
||||||
|
m_data[itemIndex].GetType().Name : "null"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)
|
public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)
|
||||||
|
|
Loading…
Reference in New Issue