From 434ba18afd5ec3e92e2725d649b898e25fcc4813 Mon Sep 17 00:00:00 2001 From: Tamas Bunth Date: Tue, 22 May 2018 14:21:08 +0200 Subject: tdf117333 dbahsql: Chain SQLExceptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic24d79f39d9cc36cf229c7410e1f96c4c3d316f9 Reviewed-on: https://gerrit.libreoffice.org/54671 Tested-by: Jenkins Reviewed-by: Tamás Bunth --- dbaccess/source/filter/hsqldb/hsqlimport.cxx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/dbaccess/source/filter/hsqldb/hsqlimport.cxx b/dbaccess/source/filter/hsqldb/hsqlimport.cxx index 83b291ccf745..260ec8665d0a 100644 --- a/dbaccess/source/filter/hsqldb/hsqlimport.cxx +++ b/dbaccess/source/filter/hsqldb/hsqlimport.cxx @@ -305,8 +305,10 @@ void HsqlImporter::importHsqlDatabase() } catch (SQLException& ex) { - if (!pException) - pException.reset(new SQLException{ ex }); + // chain errors and keep going + if (pException) + ex.NextException <<= *pException; + pException.reset(new SQLException{ std::move(ex) }); } auto statements = parser.getCreateStatements(); @@ -327,8 +329,9 @@ void HsqlImporter::importHsqlDatabase() } catch (SQLException& ex) { - if (!pException) - pException.reset(new SQLException{ ex }); + if (pException) + ex.NextException <<= *pException; + pException.reset(new SQLException{ std::move(ex) }); } } @@ -342,8 +345,9 @@ void HsqlImporter::importHsqlDatabase() } catch (SQLException& ex) { - if (!pException) - pException.reset(new SQLException{ ex }); + if (pException) + ex.NextException <<= *pException; + pException.reset(new SQLException{ std::move(ex) }); } } @@ -357,12 +361,12 @@ void HsqlImporter::importHsqlDatabase() } catch (SQLException& ex) { - if (!pException) - pException.reset(new SQLException{ ex }); + if (pException) + ex.NextException <<= *pException; + pException.reset(new SQLException{ std::move(ex) }); } } - // show first error occurred if (pException) { SAL_WARN("dbaccess", "Error during migration"); -- cgit