public static SessionRuntimeException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof SessionRuntimeException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( SessionRuntimeException ) cause : new SessionRuntimeException ( message , cause ) ; }
Converts a Throwable to a SessionRuntimeException with the specified detail message . If the Throwable is a SessionRuntimeException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new SessionRuntimeException with the detail message .