public static SessionException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof SessionException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( SessionException ) cause : new SessionException ( message , cause ) ; }
Converts a Throwable to a SessionException with the specified detail message . If the Throwable is a SessionException 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 SessionException with the detail message .