add some safety code and assertions to set_scontext_leave_for_draw

This is unnecessary but on the other hand it can't hurt, in case
someone changes the system later without realizing it would break
this.
add an assertion to lua that it is not catching unnamed exceptions

It swallows these exceptions, which is surely bad...