[Libreoffice-commits] core.git: connectivity/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 24 11:44:17 UTC 2021
connectivity/source/commontools/dbexception.cxx | 26 ++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
New commits:
commit b71079f6e145a8916e1bc7f198e7c445a7101dc8
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Sep 24 10:36:09 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 24 13:43:42 2021 +0200
split SQLExceptionInfo::append more
Change-Id: Id6dd8dfc3dc072f573e3a1a750428cb149be8e83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122569
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx
index 91ed140a2749..17f54b8bcaad 100644
--- a/connectivity/source/commontools/dbexception.cxx
+++ b/connectivity/source/commontools/dbexception.cxx
@@ -189,9 +189,9 @@ void SQLExceptionInfo::prepend( const OUString& _rErrorMessage )
namespace
{
+ // create the to-be-appended exception
Any createException(SQLExceptionInfo::TYPE eType, const OUString& rErrorMessage, const OUString& rSQLState, const sal_Int32 nErrorCode)
{
- // create the to-be-appended exception
Any aAppend;
switch (eType)
{
@@ -216,6 +216,20 @@ namespace
return aAppend;
}
+
+ // find the end of the exception chain
+ SQLException* getLastException(SQLException* pLastException)
+ {
+ SQLException* pException = pLastException;
+ while (pException)
+ {
+ pException = const_cast<SQLException*>(o3tl::tryAccess<SQLException>(pException->NextException));
+ if (!pException)
+ break;
+ pLastException = pException;
+ }
+ return pLastException;
+ }
}
void SQLExceptionInfo::append( TYPE _eType, const OUString& _rErrorMessage, const OUString& _rSQLState, const sal_Int32 _nErrorCode )
@@ -224,15 +238,7 @@ void SQLExceptionInfo::append( TYPE _eType, const OUString& _rErrorMessage, cons
Any aAppend = createException(_eType, _rErrorMessage, _rSQLState, _nErrorCode);
// find the end of the current chain
- SQLException* pLastException = const_cast<SQLException*>(o3tl::tryAccess<SQLException>(m_aContent));
- SQLException* pException = pLastException;
- while (pException)
- {
- pException = const_cast<SQLException*>(o3tl::tryAccess<SQLException>(pException->NextException));
- if (!pException)
- break;
- pLastException = pException;
- }
+ SQLException* pLastException = getLastException(const_cast<SQLException*>(o3tl::tryAccess<SQLException>(m_aContent)));
// append
if (pLastException)
More information about the Libreoffice-commits
mailing list