scope dm_initErrorHandling. static new Flag #flag; svoid dm_initErrorHandling() { raiseFlagAndDo(flag, r { _handleException_addHandler(f handler); assertNull(_onRegisterThread); _onRegisterThread = voidfunc(Thread t) { DynModule m = dm_currentModule(); if (m == null) printStackTrace("New thread made outside of a module"); else m.ownTimer(t); }; }); } svoid #handler(Throwable e) { DynModule m = dm_currentModule(); if (m == null) print("Weird: Error outside of module"); else m.setField(error := persistableThrowable(e)); } end scope