[Kmymoney-devel] Exceptions in MyMoneyFile

victor pedretti_86 at hotmail.com
Wed Feb 25 17:06:27 UTC 2015


Please, could you help me with this message I wrote I few days ago? It is important for me to know how to reach these exception handlers. I have also found another handler in MyMoneyMoney which is not reached by the tests:

MyMoneyMoney::MyMoneyMoney(const QString& pszAmount): AlkValue()
{
  try {
    AlkValue safeValue(pszAmount, _decimalSeparator);
    *this = safeValue;
  } catch (const std::invalid_argument &) {
    qWarning("Invalid argument passed to AlkValue() in MyMoneyMoney. Arguments to ctor: '%s', '%c'", qPrintable(pszAmount), _decimalSeparator.toLatin1());
  }
}

Thanks in advance.
__________________________

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?
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20150225/91efa1a0/attachment.html>


More information about the KMyMoney-devel mailing list