server/executionhandlers/ruby/connection.rb in cpee-2.1.37 vs server/executionhandlers/ruby/connection.rb in cpee-2.1.38

- old
+ new

@@ -30,12 +30,16 @@ def self::inform_state_change(arguments,newstate) # {{{ controller = arguments[0] controller.notify("state/change", :state => newstate) end # }}} def self::inform_syntax_error(arguments,err,code)# {{{ + # TODO extract spot (code) where error happened for better error handling (ruby 3.1 only) + # https://github.com/rails/rails/pull/45818/commits/3beb2aff3be712e44c34a588fbf35b79c0246ca5 controller = arguments[0] - controller.notify("description/error", :message => err.backtrace[0].gsub(/([\w -_]+):(\d+):in.*/,'\\1, Line \2: ') + err.message) + mess = err.backtrace ? err.backtrace[0].gsub(/([\w -_]+):(\d+):in.*/,'\\1, Line \2: ') : '' + mess += err.message + controller.notify("description/error", :message => mess) end# }}} def self::inform_connectionwrapper_error(arguments,err) # {{{ controller = arguments[0] p err.message p err.backtrace @@ -361,11 +365,15 @@ end end #}}} def test_condition(mr,code) res = mr.instance_eval(code,'Condition',1) - @controller.notify("condition/eval", :instance_uuid => @controller.uuid, :code => code, :condition => (res ? "true" : "false")) + @controller.notify("gateway/decide", :instance_uuid => @controller.uuid, :code => code, :condition => (res ? "true" : "false")) res + end + + def join_branches(branches) # factual, so for inclusive or [[a],[b],[c,d,e]] + @controller.notify("gateway/join", :instance_uuid => @controller.uuid, :branches => branches) end def simulate(type,nesting,tid,parent,parameters={}) #{{{ @controller.vote("simulating/step", :'activity-uuid' => @handler_activity_uuid,