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

23
LINES

< > BotCompany Repo | #1034832 // TimeoutException using getCause() - doesn't work because they are from different threads. I guess!?

JavaX fragment (include)

srecord noeq TimeoutException(double timeoutSeconds,
  O function,
  Thread thread) extends RuntimeException {
  @Override
  public S getMessage() {
    ret "Timeout after " + iceil(timeoutSeconds) + "s by " + shorten_str(function);
  }
  
  StackTraceElement[] innerStackTrace() {
    ret thread.getStackTrace();
  }
  
  public cached Cause getCause() {
    ret new Cause;
  }
  
  class Cause > Throwable {
    *() {
      super("Still calculating", null, false, true);
      setStackTrace(innerStackTrace());
    }
  }
}

Author comment

Began life as a copy of #1034249

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034832
Snippet name: TimeoutException using getCause() - doesn't work because they are from different threads. I guess!?
Eternal ID of this version: #1034832/2
Text MD5: b9e6a24284cd4061076b405d88a057df
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-11 03:15:31
Source code size: 546 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 132 / 143
Version history: 1 change(s)
Referenced in: [show references]