Purpose of this patch is to simplify exception handling in KMyMoney by replacing MyMoneyException class with std::runtime_error. The advantage of this is that:
- we use code from standard library,
- we have less to compile,
- we catch all std::exceptions instead of MyMoneyException only.
mymoneyexception.h remains and contains header for std::runtime_error and two defines for customizing exception messages.
First define, MYMONEYEXCEPTION constructs the message roughly in the following way:
- construct QString from LINE, which is int,
- construct QString from FILE, which is const char *,
- take exception message, only QStrings allowed,
- construct QString from the three strings above,
- construct const char * from QString, for which std::runtime_error has a constructor.
As one can see, there is lot of effort to throw an exception, so there MYMONEYEXCEPTION_CSTRING has been introduced, to avoid all above mentioned memory allocations.