code: public static Exception rethrow(Throwable throwable) throws Error {
          try {
              throw throwable;
          } catch (Error error) {
              throw error;
          } catch (Exception exception) {
              return exception;
          } catch (Throwable throwable2) {
              return msg.undeclaredThrowable(throwable2);
          }
      }
docs: Convenience method to get a {@link Throwable} as an {@link Exception}.
  
  @param throwable the throwable
  @return the exception to throw
  @throws Error if the throwable is an error type