Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data


< > BotCompany Repo | #1015957 // dm_initErrorHandling - and thread-to-module registration

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (13062L/81K).

scope dm_initErrorHandling.

please include function _registerThread.
please include function _threadInheritInfo.
please include function _threadInfo.
please include function _onAWTEnter.

static new Flag #flag;

svoid dm_initErrorHandling() {
  raiseFlagAndDo(flag, r {
    _handleException_addHandler(lambda1 handler);
    _onRegisterThread = voidfunc(Thread t) {
      O m = dm_current_generic();
      if (m == null) printStackTrace("New thread made outside of a module");
      else if (m cast DynModule) m.ownTimer(t);
    _threadInfo_makers.add(voidfunc(Map map) { mapPut(map, "currentModule", dm_currentModule()) });
    _threadInheritInfo_retrievers.add(voidfunc(Map map) {
      O mod = map.get("currentModule");
      if (mod cast DynModule)
        dm_current_generic_tl().set(new WeakReference(mod));

svoid #handler(Throwable e) {
  DynModule m = dm_currentModule();
  if (m == null)
    print("Weird: Error outside of module");
    m.setField(_error := persistableThrowable(e));

end scope

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015957
Snippet name: dm_initErrorHandling - and thread-to-module registration
Eternal ID of this version: #1015957/22
Text MD5: 2c3cdbd7d4d93587f182fc5f4c9e7dbe
Transpilation MD5: f15cb51734c22a9fd889a396ba0b0df9
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-07-01 20:22:10
Source code size: 1112 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 394 / 518
Version history: 21 change(s)
Referenced in: [show references]