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

29
LINES

< > BotCompany Repo | #1004975 // class PersistableThrowable

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

Libraryless. Click here for Pure Java version (9663L/53K).

1  
// TODO: subclass RuntimeException and use Meta instead of DynamicObject
2  
static class PersistableThrowable extends DynamicObject {
3  
  S className;
4  
  S msg;
5  
  S stacktrace;
6  
  settable transient Throwable actualThrowable;
7  
  
8  
  *() {}
9  
  *(Throwable e) {
10  
    actualThrowable = e;
11  
    if (e == null)
12  
      className = "Crazy Null Error";
13  
    else {
14  
      className = getClassName(e).replace('/', '.');
15  
      msg = e.getMessage();
16  
      stacktrace = getStackTrace_noRecord(e);
17  
    }
18  
  }
19  
  
20  
  public S toString() {
21  
    ret nempty(msg) ? className + ": " + msg : className;
22  
  }
23  
  
24  
  RuntimeException asRuntimeException() {
25  
    if (actualThrowable != null)
26  
      ret main asRuntimeException(actualThrowable);
27  
    ret new Fail(this);
28  
  }
29  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1004975
Snippet name: class PersistableThrowable
Eternal ID of this version: #1004975/8
Text MD5: 7bc69bb0021c583bec13eee368f968e5
Transpilation MD5: 5380ce62739ca0955bb7cf7881ec6552
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-26 22:26:27
Source code size: 756 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 588 / 1598
Version history: 7 change(s)
Referenced in: [show references]