<LocalJumpError: return from proc-closure> in WebDialog
-
Google search found a two-year old thread near this topic, which helped me work around a Ruby bug. This post is for the next victim of this bug.
With smaller models, this code, in an action callback, worked:
# update some stuff return if msg.nil? # msg == a callback argument handle the msg
With a large model, it failed, showing the title error. This solved the problem:
# update some stuff unless msg.nil? handle the msg end
-
Interesting... Glad the model helped then. Wonder what caused it...?
-
I don't know the finer details yet, but
return
ing from a proc causes the error.You also get similar errors if you try to
return
values from command validation procs.This causes an error.
def my_validation_proc if Sketchup.active_model.selection.nitems == 1 return MF_ENABLED else return MF_GRAYED end end
This does not
def my_validation_proc if Sketchup.active_model.selection.nitems == 1 MF_ENABLED else MF_GRAYED end end
-
Rather odd, isn't it, as return is implied in Ruby... no?
-
Maybe, but I don't understand it myself. Rather than returning from the proc, the proc itself evaluates, and that is what is returned.
Advertisement