[Kmymoney-devel] Exceptions in MyMoneyFile

victor pedretti_86 at hotmail.com
Fri Feb 20 16:14:00 UTC 2015


Hi,

I have been analyzing the code of mymoneyfile.cpp and I was wondering how some of the exceptions handlers could be accessed. 

The first one is the exception handler in "QString MyMoneyFile::storageId(void)". "testStorageId" in mymoneyfiletest.cpp is devoted to this method, but the exception is not thrown in it.

The second one is in "const MyMoneyAccount MyMoneyFile::openingBalanceAccount(const MyMoneySecurity& s). The first "catch" is accessed twice in "testOpeningBalance", but the second nested catch is not. I cannot think of a situation that allows me to access this handler (in bold):

  try {
    return openingBalanceAccount_internal(security);
  } catch (MyMoneyException *e) {
    delete e;
    MyMoneyFileTransaction ft;
    MyMoneyAccount acc;

    try {
      acc = createOpeningBalanceAccount(security);
      ft.commit();

    } catch (MyMoneyException* e) {
      qDebug("Unable to create opening balance account for security %s", qPrintable(security.id()));
      delete e;
    }
    return acc;
  }

Does anybody know which those try-catch blocks were implemented?

Thanks in advance.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20150220/d1f0709f/attachment.html>


More information about the KMyMoney-devel mailing list