-
Łukasz Wojniłowicz authored
MyMoneyException changes in following way: 1) Untranslated exceptions, as normal user doesn't need to understand exceptions, only developers do, 2) Tidied up catching phrase, so it's always catched by const reference, 3) no d-pointer (there should be no cascade header inclusion) and reduced implementation to only what() method, 4) we use code from standard library, which implements what() method, so we have less to compile, 5) MyMoneyException constructor is inlined, but it should be short, because of the use of POD types only, 6) two defines to throw an exception (explanation below). mymoneyexception.h contains header for std::runtime_error and two defines for customizing exception messages. First define, MYMONEYEXCEPTION constructs the message roughly in the following way: 1) construct QString from __LINE__, which is int, 2) construct QString from __FILE__, which is const char *, 3) take exception message, only QStrings allowed, 4) construct QString from the three strings above, 5) 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. Differential Revision: https://phabricator.kde.org/D12808
284a0331