tdf#117333 dbahsql exception handling

Lionel Elie Mamane lionel at mamane.lu
Wed May 16 09:45:52 UTC 2018


Hi,

It looks to me like your patch will not keep subtypes (types derived
from) SQLException, but will instead "truncate" them to a
SQLException, and thus lose information.

Additionally, I would suggest, instead of silently suppressing all
subsequent errors, to chain all errors in one SQLException and then to
show them all in one dialog.

An SQLException has a "NextException" member, just stick the next
exception there. To avoid a Schlemiel the Painter / quadratic
algorithm, you can do something like (and factorise it in function,
I'd say), with the right Any-magic operators (<<=, >>=, etc) instead of
"=":

std::unique_ptr<SQLException> pTopException;
std::unique_ptr<SQLException> pBotException;

catch(SQLException &ex)
{
  if (!pTopException)
  {
    pTopException.reset(ex);
    pLastException.reset(ex);
  }
  else
  {
    assert(pLastException);
    while(pLastException->NextException is not empty)
    {
      pLastException.reset(pLastException->NextException);
      // This assumes pLastException will be a SQLException;
      // if it is not, I'm not sure what to do.
    }
    pLastException->NextException = ex;
  }
}

On Wed, May 16, 2018 at 09:11:40AM +0000, bugzilla-daemon at bugs.documentfoundation.org wrote:
> https://bugs.documentfoundation.org/show_bug.cgi?id=117333
> 
> --- Comment #3 from Commit Notification <libreoffice-commits at lists.freedesktop.org> ---
> Tamas Bunth committed a patch related to this issue.
> It has been pushed to "master":
> 
> http://cgit.freedesktop.org/libreoffice/core/commit/?id=ea19b96b6beb0ce2f25705339d1d6342dc38b283
> 
> tdf#117333, tdf#117325 dbahsql: exception handling
> 
> It will be available in 6.1.0.
> 
> The patch should be included in the daily builds available at
> http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
> information about daily builds can be found at:
> http://wiki.documentfoundation.org/Testing_Daily_Builds
> 
> Affected users are encouraged to test the fix and report feedback.
> 


More information about the LibreOffice mailing list