Author Topic: ? on behavior of Rule when Action doesn't respond happily!  (Read 2380 times)

Deane Johnson

  • Guest
? on behavior of Rule when Action doesn't respond happily!
« on: June 27, 2011, 08:42:46 am »
I have a Rule that turns on various lights at 5:00 am each day.  Lately, it has been failing some days to execute past the first Action which is to turn on a Z-Wave lamp (Light 31).  The Lamp (31) turns on OK.  It appears in the log that if Elve doesn't get a happy response from that Z-Wave Module, it stops and does nothing further.

In addition to wondering what Elve isn't getting fed back that it wants, why it is a good idea for Elve to stop running the rule at that point.  Wouldn't it be better if it finished, or perhaps had a "run regardless" check box, or something.  In this case, going ahead and finishing the Rule would be significantly better than giving up after the first action didn't complete.

The error log is below.



Date:     6/27/2011
Time:     5:00 AM
Severity: Error
Source:   MasterService
Computer: DEANE
Context Type: Script
Context Name: rule '5:00AM Lights On'
Description:
An error occurred while executing the script rule '5:00AM Lights On'.
ScriptEvaluatorException: An unknown error occurred while evaluating the script.  TargetInvocationException: Exception has been thrown by the target of an invocation.  ViziaRFTransmissionException: Exception of type 'ViziaRFLibrary.ViziaRFTransmissionException' was thrown.

CodecoreTechnologies.Elve.DriverFramework.Scripting.ScriptEvaluatorException: An unknown error occurred while evaluating the script. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> ViziaRFLibrary.ViziaRFTransmissionException: Exception of type 'ViziaRFLibrary.ViziaRFTransmissionException' was thrown.
   --- End of inner exception stack trace ---

Server stack trace:
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at CodecoreTechnologies.Elve.DriverFramework.Scripting.ScriptObject.InvokeMethod(IScriptObject o, String methodName, Object[] parameters, IScriptObject& result)
   at CodecoreTechnologies.Elve.DriverFramework.Scripting.ScriptMarshalByRefObject.InvokeMethod(String methodName, IScriptObject[] parameters, IScriptObject& result)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at
  • :

   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at CodecoreTechnologies.Elve.DriverFramework.Scripting.IScriptObject.InvokeMethod(String methodName, IScriptObject[] parameters, IScriptObject& result)
   at Common.ScriptEvaluator.ScriptEvaluator.objectMemberAndArrayMember()
   at Common.ScriptEvaluator.ScriptEvaluator.postIncrementDecrement()
   at Common.ScriptEvaluator.ScriptEvaluator.factor()
   at Common.ScriptEvaluator.ScriptEvaluator.multiplicative()
   at Common.ScriptEvaluator.ScriptEvaluator.additive()
   at Common.ScriptEvaluator.ScriptEvaluator.bitwiseShift()
   at Common.ScriptEvaluator.ScriptEvaluator.relational()
   at Common.ScriptEvaluator.ScriptEvaluator.equality()
   at Common.ScriptEvaluator.ScriptEvaluator.bitwiseAnd()
   at Common.ScriptEvaluator.ScriptEvaluator.bitwiseExclusiveOr()
   at Common.ScriptEvaluator.ScriptEvaluator.bitwiseInclusiveOr()
   at Common.ScriptEvaluator.ScriptEvaluator.logicalAnd()
   at Common.ScriptEvaluator.ScriptEvaluator.logicalOr()
   at Common.ScriptEvaluator.ScriptEvaluator.variableAssignment()
   at Common.ScriptEvaluator.ScriptEvaluator.evaluateBlock()
   at Common.ScriptEvaluator.ScriptEvaluator.evaluate(ScriptParser parser, ScriptVariableCollection variables, EvaluateFunctionDelegate evaluatefunction, ScriptObjectTypeInfoCollection objectInfos, ScriptFunctionInfoCollection scriptFunctionInfos)
   --- End of inner exception stack trace ---
   at Common.ScriptEvaluator.ScriptEvaluator.evaluate(ScriptParser parser, ScriptVariableCollection variables, EvaluateFunctionDelegate evaluatefunction, ScriptObjectTypeInfoCollection objectInfos, ScriptFunctionInfoCollection scriptFunctionInfos)
   at Common.ScriptEvaluator.ScriptEvaluator.Evaluate(ScriptParser parser, ScriptVariableCollection variables, EvaluateFunctionDelegate evaluatefunction, ScriptObjectTypeInfoCollection objectInfos, ScriptFunctionInfoCollection scriptFunctionInfos)
   at Common.ScriptEvaluator.ScriptEvaluator.Evaluate(String s, ScriptPosition position, ScriptVariableCollection variables, EvaluateFunctionDelegate evaluatefunction, ScriptObjectTypeInfoCollection objectInfos, ScriptFunctionInfoCollection scriptFunctionInfos)
   at Common.ScriptEvaluator.ScriptEvaluator.Evaluate(String s, ScriptVariableCollection variables, EvaluateFunctionDelegate evaluatefunction, ScriptObjectTypeInfoCollection objectInfos, ScriptFunctionInfoCollection scriptFunctionInfos)
   at Common.ScriptEvaluator.ScriptEvaluator.Evaluate(String s, ScriptVariableCollection variables, EvaluateFunctionDelegate evaluatefunction, ScriptObjectTypeInfoCollection objectInfos)
   at Common.ScriptEvaluator.ScriptEvaluator.EvaluateNow(String s, ScriptVariableCollection variables, EvaluateFunctionDelegate evaluatefunction, ScriptObjectTypeInfoCollection objectInfos)
   at MasterService.ScriptRunner.RunNow(String scriptName, String script, ScriptVariableCollection extraScriptVariables, Boolean throwError)
Location in script: line 2, column 24.

lighting.TurnOnLight(31);
                       ^


John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2852
    • View Profile
    • Codecore Technologies
Re: ? on behavior of Rule when Action doesn't respond happily!
« Reply #1 on: June 27, 2011, 09:24:18 am »
As you noted, the ViziaRF driver does throw an exception (ie an error) if the zwave module has trouble communicating with the destination. The default behavior is to prevent the rest of the script from running. You can get around this by wrapping the line in try/catch blocks using the scripting language.

However I think you are right that we should provide an option to suppress the transmission error.

The try/catch keywords are explained in the scripting language documentation. Here is a simple example:

Code: [Select]
try
{
   lighting.TurnOnLight(5);
}
catch (ex)
{
  // this code runs when the error occurs. If you don't want to do anything special then you can leave this block empty.
}

try
{
   lighting.TurnOnLight(6);
}
catch (ex)
{
  // this code runs when the error occurs. If you don't want to do anything special then you can leave this block empty.
}
« Last Edit: June 27, 2011, 09:27:40 am by John Hughes »
John Hughes
Codecore Technologies