Better error logging in Tcl/JS emulation