<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>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:<br><br><font style="font-size: 10pt;" size="2">MyMoneyMoney::MyMoneyMoney(const QString& pszAmount): AlkValue()</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2">{</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2"> try {</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2"> AlkValue safeValue(pszAmount, _decimalSeparator);</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2"> *this = safeValue;</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2"> </font><font style="font-size: 10pt;" size="2"><b>} catch (const std::invalid_argument &) {<br> qWarning("Invalid argument passed to AlkValue() in MyMoneyMoney. Arguments to ctor: '%s', '%c'", qPrintable(pszAmount), _decimalSeparator.toLatin1());<br> }</b></font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2">}</font><br><br>Thanks in advance.<br>__________________________<br><br>Hi,<br><br>I have been analyzing the code of <i>mymoneyfile.cpp</i> and I was wondering how some of the exceptions handlers could be accessed. <br><br>The first one is the exception handler in "QString MyMoneyFile::storageId(void)". "testStorageId" in <i>mymoneyfiletest.cpp</i> is devoted to this method, but the exception is not thrown in it.<br><br>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):<br><br> <font style="font-size:8pt;" size="1"> try {</font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> return openingBalanceAccount_internal(security);</font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> } catch (MyMoneyException *e) {</font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> delete e;</font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> MyMoneyFileTransaction ft;</font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> MyMoneyAccount acc;</font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> try {</font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> acc = createOpeningBalanceAccount(security);</font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> ft.commit();</font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> </font><font style="font-size:8pt;" size="1"><b>} catch (MyMoneyException* e) {<br> qDebug("Unable to create opening balance account for security %s", qPrintable(security.id()));<br> delete e;<br> }</b></font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> return acc;</font><font style="font-size:8pt;" size="1"><br></font><font style="font-size:8pt;" size="1"> }</font><br><br>Does anybody know which those try-catch blocks were implemented?<br> </div></body>
</html>