Kaydet (Commit) 20c4c3ac authored tarafından Noel Grandin's avatar Noel Grandin

store originating exception when re-throwing

Change-Id: I26959d3604a581f1528e575239970ab364c7fd50
Reviewed-on: https://gerrit.libreoffice.org/67413
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst dcc06dee
...@@ -400,7 +400,7 @@ void throwGenericSQLException(const OUString& _rMsg, const Reference< XInterface ...@@ -400,7 +400,7 @@ void throwGenericSQLException(const OUString& _rMsg, const Reference< XInterface
throw SQLException( _rMsg, _rxSource, getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 0, _rNextException); throw SQLException( _rMsg, _rxSource, getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 0, _rNextException);
} }
void throwFeatureNotImplementedSQLException( const OUString& _rFeatureName, const Reference< XInterface >& _rxContext ) void throwFeatureNotImplementedSQLException( const OUString& _rFeatureName, const Reference< XInterface >& _rxContext, const Any& _rNextException )
{ {
::connectivity::SharedResources aResources; ::connectivity::SharedResources aResources;
const OUString sError( aResources.getResourceStringWithSubstitution( const OUString sError( aResources.getResourceStringWithSubstitution(
...@@ -413,7 +413,7 @@ void throwFeatureNotImplementedSQLException( const OUString& _rFeatureName, cons ...@@ -413,7 +413,7 @@ void throwFeatureNotImplementedSQLException( const OUString& _rFeatureName, cons
_rxContext, _rxContext,
getStandardSQLState( StandardSQLState::FEATURE_NOT_IMPLEMENTED ), getStandardSQLState( StandardSQLState::FEATURE_NOT_IMPLEMENTED ),
0, 0,
Any() _rNextException
); );
} }
......
...@@ -1068,12 +1068,12 @@ bool ODbaseTable::CreateImpl() ...@@ -1068,12 +1068,12 @@ bool ODbaseTable::CreateImpl()
} }
catch(const Exception&) catch(const Exception&)
{ {
css::uno::Any anyEx = cppu::getCaughtException();
const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
STR_COULD_NOT_DELETE_FILE, STR_COULD_NOT_DELETE_FILE,
"$name$", aName "$name$", aName
) ); ) );
::dbtools::throwGenericSQLException( sError, *this ); ::dbtools::throwGenericSQLException( sError, *this, anyEx );
} }
} }
if (!CreateMemoFile(aURL)) if (!CreateMemoFile(aURL))
...@@ -1086,11 +1086,12 @@ bool ODbaseTable::CreateImpl() ...@@ -1086,11 +1086,12 @@ bool ODbaseTable::CreateImpl()
} }
catch(const ContentCreationException&) catch(const ContentCreationException&)
{ {
css::uno::Any anyEx = cppu::getCaughtException();
const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
STR_COULD_NOT_DELETE_FILE, STR_COULD_NOT_DELETE_FILE,
"$name$", aName "$name$", aName
) ); ) );
::dbtools::throwGenericSQLException( sError, *this ); ::dbtools::throwGenericSQLException( sError, *this, anyEx );
} }
return false; return false;
} }
......
...@@ -701,9 +701,11 @@ void java_sql_Connection::loadDriverFromProperties( const OUString& _sDriverClas ...@@ -701,9 +701,11 @@ void java_sql_Connection::loadDriverFromProperties( const OUString& _sDriverClas
} }
catch( Exception& ) catch( Exception& )
{ {
css::uno::Any anyEx = cppu::getCaughtException();
::dbtools::throwGenericSQLException( ::dbtools::throwGenericSQLException(
lcl_getDriverLoadErrorMessage( getResources(),_sDriverClass, _sDriverClassPath ), lcl_getDriverLoadErrorMessage( getResources(),_sDriverClass, _sDriverClassPath ),
*this *this,
anyEx
); );
} }
} }
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <comphelper/property.hxx> #include <comphelper/property.hxx>
#include <connectivity/CommonTools.hxx> #include <connectivity/CommonTools.hxx>
#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <comphelper/sequence.hxx> #include <comphelper/sequence.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp>
#include <TConnection.hxx> #include <TConnection.hxx>
...@@ -729,7 +730,8 @@ void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, con ...@@ -729,7 +730,8 @@ void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, con
} }
catch(const Exception&) catch(const Exception&)
{ {
::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateBinaryStream", *this ); Any anyEx = ::cppu::getCaughtException();
::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateBinaryStream", *this, anyEx );
} }
} }
...@@ -760,7 +762,8 @@ void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex, ...@@ -760,7 +762,8 @@ void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex,
} }
catch(const Exception&) catch(const Exception&)
{ {
::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateCharacterStream", *this ); Any anyEx = ::cppu::getCaughtException();
::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateCharacterStream", *this, anyEx );
} }
} }
......
...@@ -2214,7 +2214,7 @@ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionH ...@@ -2214,7 +2214,7 @@ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionH
Any aError = ::cppu::getCaughtException(); Any aError = ::cppu::getCaughtException();
OUString sMessage = ResourceManager::loadString( RID_NO_SUCH_DATA_SOURCE, OUString sMessage = ResourceManager::loadString( RID_NO_SUCH_DATA_SOURCE,
"$name$", m_aDataSourceName, "$error$", extractExceptionMessage( m_aContext, aError ) ); "$name$", m_aDataSourceName, "$error$", extractExceptionMessage( m_aContext, aError ) );
::dbtools::throwGenericSQLException( sMessage, *this ); ::dbtools::throwGenericSQLException( sMessage, *this, aError );
} }
} }
setActiveConnection(xNewConn); setActiveConnection(xNewConn);
...@@ -2574,9 +2574,10 @@ void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Referenc ...@@ -2574,9 +2574,10 @@ void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Referenc
m_bParametersDirty = true; m_bParametersDirty = true;
x->closeInput(); x->closeInput();
} }
catch( Exception& ) catch( Exception const & )
{ {
throw SQLException(); css::uno::Any anyEx = cppu::getCaughtException();
throw SQLException("ORowSet::setBinaryStream", *this, "S1000", 0,anyEx);
} }
} }
...@@ -2597,9 +2598,10 @@ void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Refer ...@@ -2597,9 +2598,10 @@ void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Refer
rParamValue.setTypeKind( DataType::LONGVARCHAR ); rParamValue.setTypeKind( DataType::LONGVARCHAR );
x->closeInput(); x->closeInput();
} }
catch( Exception& ) catch( Exception const & )
{ {
throw SQLException(); css::uno::Any anyEx = cppu::getCaughtException();
throw SQLException("ORowSet::setCharacterStream", *this, "S1000", 0, anyEx);
} }
} }
......
...@@ -272,7 +272,8 @@ OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException( ...@@ -272,7 +272,8 @@ OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException(
*/ */
OOO_DLLPUBLIC_DBTOOLS void throwFeatureNotImplementedSQLException( OOO_DLLPUBLIC_DBTOOLS void throwFeatureNotImplementedSQLException(
const OUString& _rFeatureName, const OUString& _rFeatureName,
const css::uno::Reference< css::uno::XInterface >& _rxContext const css::uno::Reference< css::uno::XInterface >& _rxContext,
const css::uno::Any& _rNextException = css::uno::Any()
); );
/** throw a RuntimeException (Optional feature not implemented) /** throw a RuntimeException (Optional feature not implemented)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment