Mercurial Hosting > nabble
comparison src/fschmidt/util/java/ComputationException.java @ 68:00520880ad02
add fschmidt source
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Sun, 05 Oct 2025 17:24:15 -0600 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 67:9d0fefce6985 | 68:00520880ad02 |
|---|---|
| 1 package fschmidt.util.java; | |
| 2 | |
| 3 import java.util.concurrent.ExecutionException; | |
| 4 | |
| 5 | |
| 6 public final class ComputationException extends RuntimeException { | |
| 7 | |
| 8 public ComputationException(Exception e) { | |
| 9 super(e); | |
| 10 } | |
| 11 | |
| 12 public static ComputationException newInstance(ExecutionException e) { | |
| 13 Throwable cause = e.getCause(); | |
| 14 if( cause instanceof Error ) | |
| 15 throw (Error)cause; | |
| 16 if( cause instanceof RuntimeException ) | |
| 17 throw (RuntimeException)cause; | |
| 18 if( cause instanceof Exception ) | |
| 19 return new ComputationException((Exception)cause); | |
| 20 return new ComputationException(e); | |
| 21 } | |
| 22 } |
