Libraryless. Click here for Pure Java version (13062L/81K).
1 | scope dm_initErrorHandling. |
2 | |
3 | please include function _registerThread. |
4 | please include function _threadInheritInfo. |
5 | please include function _threadInfo. |
6 | please include function _onAWTEnter. |
7 | |
8 | static new Flag #flag; |
9 | |
10 | svoid dm_initErrorHandling() { |
11 | raiseFlagAndDo(flag, r { |
12 | _handleException_addHandler(lambda1 handler); |
13 | |
14 | assertNull(_onRegisterThread); |
15 | _onRegisterThread = voidfunc(Thread t) { |
16 | O m = dm_current_generic(); |
17 | if (m == null) printStackTrace("New thread made outside of a module"); |
18 | else if (m cast DynModule) m.ownTimer(t); |
19 | }; |
20 | _threadInfo_makers.add(voidfunc(Map map) { mapPut(map, "currentModule", dm_currentModule()) }); |
21 | _threadInheritInfo_retrievers.add(voidfunc(Map map) { |
22 | O mod = map.get("currentModule"); |
23 | if (mod cast DynModule) |
24 | dm_current_generic_tl().set(new WeakReference(mod)); |
25 | }); |
26 | }); |
27 | } |
28 | |
29 | svoid #handler(Throwable e) { |
30 | DynModule m = dm_currentModule(); |
31 | if (m == null) |
32 | print("Weird: Error outside of module"); |
33 | else |
34 | m.setField(_error := persistableThrowable(e)); |
35 | } |
36 | |
37 | 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: | 488 / 644 |
Version history: | 21 change(s) |
Referenced in: | [show references] |