[Libreoffice-commits] core.git: connectivity/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 24 11:20:03 UTC 2021
connectivity/source/commontools/dbexception.cxx | 47 +++++++++++++++---------
1 file changed, 31 insertions(+), 16 deletions(-)
New commits:
commit 66636097f0464beffa678e0898bf379718494c10
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Sep 24 10:04:16 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 24 13:19:27 2021 +0200
split SQLExceptionInfo::append
Change-Id: I4e86e580843042e482e8732843a45a9eedfad320
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122567
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx
index 2efc4a6976b3..624999d8dd94 100644
--- a/connectivity/source/commontools/dbexception.cxx
+++ b/connectivity/source/commontools/dbexception.cxx
@@ -187,25 +187,41 @@ void SQLExceptionInfo::prepend( const OUString& _rErrorMessage )
m_eType = TYPE::SQLException;
}
-
-void SQLExceptionInfo::append( TYPE _eType, const OUString& _rErrorMessage, const OUString& _rSQLState, const sal_Int32 _nErrorCode )
+namespace
{
- // create the to-be-appended exception
- Any aAppend;
- switch ( _eType )
+ Any createException(SQLExceptionInfo::TYPE eType, const OUString& rErrorMessage, const OUString& rSQLState, const sal_Int32 nErrorCode)
{
- case TYPE::SQLException: aAppend <<= SQLException(); break;
- case TYPE::SQLWarning: aAppend <<= SQLWarning(); break;
- case TYPE::SQLContext: aAppend <<= SQLContext(); break;
- default:
- TOOLS_WARN_EXCEPTION( "connectivity.commontools", "SQLExceptionInfo::append: invalid exception type: this will crash!" );
- break;
+ // create the to-be-appended exception
+ Any aAppend;
+ switch (eType)
+ {
+ case SQLExceptionInfo::TYPE::SQLException:
+ aAppend <<= SQLException();
+ break;
+ case SQLExceptionInfo::TYPE::SQLWarning:
+ aAppend <<= SQLWarning();
+ break;
+ case SQLExceptionInfo::TYPE::SQLContext:
+ aAppend <<= SQLContext();
+ break;
+ default:
+ TOOLS_WARN_EXCEPTION("connectivity.commontools", "SQLExceptionInfo::createException: invalid exception type: this will crash!");
+ break;
+ }
+
+ SQLException& pAppendException = const_cast<SQLException &>(*o3tl::forceAccess<SQLException>(aAppend));
+ pAppendException.Message = rErrorMessage;
+ pAppendException.SQLState = rSQLState;
+ pAppendException.ErrorCode = nErrorCode;
+
+ return aAppend;
}
+}
- SQLException& pAppendException = const_cast<SQLException &>(*o3tl::forceAccess<SQLException>(aAppend));
- pAppendException.Message = _rErrorMessage;
- pAppendException.SQLState = _rSQLState;
- pAppendException.ErrorCode = _nErrorCode;
+void SQLExceptionInfo::append( TYPE _eType, const OUString& _rErrorMessage, const OUString& _rSQLState, const sal_Int32 _nErrorCode )
+{
+ // create the to-be-appended exception
+ Any aAppend = createException(_eType, _rErrorMessage, _rSQLState, _nErrorCode);
// find the end of the current chain
Any* pChainIterator = &m_aContent;
@@ -233,7 +249,6 @@ void SQLExceptionInfo::append( TYPE _eType, const OUString& _rErrorMessage, cons
}
}
-
void SQLExceptionInfo::doThrow()
{
if ( m_aContent.getValueTypeClass() == TypeClass_EXCEPTION )
More information about the Libreoffice-commits
mailing list