Propagates throwable
as-is if it is an instance of RuntimeException
or
Error
, or else as a last resort, wraps
it in a RuntimeException
then propagates.
Propagates throwable
as-is if it is an instance of RuntimeException
or
Error
, or else as a last resort, wraps
it in a RuntimeException
then propagates.
This method always throws an exception. The RuntimeException
return type is only for
client code to make Java type system happy in case a return value is required by the enclosing
method. Example usage:
T doSomething() { try { return someMethodThatCouldThrowAnything(); } catch (IKnowWhatToDoWithThisException e) { return handle(e); } catch (Throwable t) { throw Throwables.propagate(t); } }
the Throwable to propagate
nothing will ever be returned; this return type is only for your convenience, as illustrated in the example above
Propagates throwable
exactly as-is, if and only if it is an
instance of declaredType
.
Propagates throwable
exactly as-is, if and only if it is an
instance of declaredType
. Example usage:
try { someMethodThatCouldThrowAnything(); } catch (IKnowWhatToDoWithThisException e) { handle(e); } catch (Throwable t) { Throwables.propagateIfInstanceOf(t, IOException.class); Throwables.propagateIfInstanceOf(t, SQLException.class); throw Throwables.propagate(t); }
Returns a string containing the result of toString()
, followed by
the full, recursive
stack trace of throwable
.
Returns a string containing the result of toString()
, followed by
the full, recursive
stack trace of throwable
. Note that you probably should not be
parsing the resulting string; if you need programmatic access to the stack
frames, you can call Throwable#getStackTrace()
.
Static utility methods pertaining to instances of
Throwable
.3.0