Example usage for org.springframework.transaction TransactionSystemException getMostSpecificCause

List of usage examples for org.springframework.transaction TransactionSystemException getMostSpecificCause

Introduction

In this page you can find the example usage for org.springframework.transaction TransactionSystemException getMostSpecificCause.

Prototype

public Throwable getMostSpecificCause() 

Source Link

Document

Retrieve the most specific cause of this exception, that is, either the innermost cause (root cause) or this exception itself.

Usage

From source file:ch.systemsx.cisd.openbis.plugin.generic.client.web.server.GenericClientService.java

public DataSetUpdateResult updateDataSet(final DataSetUpdates updates)
        throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException {
    try {/*from w w w.  java  2s.co  m*/
        final String sessionToken = getSessionToken();
        return genericServer.updateDataSet(sessionToken, createDataSetUpdatesDTO(updates));
    } catch (TransactionSystemException e) {
        // Deferred triger may throw an exception just before commit.
        // Message in the exception is readable for the user.
        throw UserFailureExceptionTranslator
                .translate(new UserFailureException(e.getMostSpecificCause().getMessage()));
    } catch (final ch.systemsx.cisd.common.exceptions.UserFailureException e) {
        throw UserFailureExceptionTranslator.translate(e);
    }
}