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).

// TODO: subclass RuntimeException and use Meta instead of DynamicObject
static class PersistableThrowable extends DynamicObject {
  S className;
  S msg;
  S stacktrace;
  settable transient Throwable actualThrowable;
  
  *() {}
  *(Throwable e) {
    actualThrowable = e;
    if (e == null)
      className = "Crazy Null Error";
    else {
      className = getClassName(e).replace('/', '.');
      msg = e.getMessage();
      stacktrace = getStackTrace_noRecord(e);
    }
  }
  
  public S toString() {
    ret nempty(msg) ? className + ": " + msg : className;
  }
  
  RuntimeException asRuntimeException() {
    if (actualThrowable != null)
      ret main asRuntimeException(actualThrowable);
    ret new Fail(this);
  }
}

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: 654 / 1685
Version history: 7 change(s)
Referenced in: [show references]