#ifndef H_LIBTHROWABLE_USER_FAULT#define H_LIBTHROWABLE_USER_FAULT#include "exception.h"namespace libthrowable {/** This class describes an Exception object directly aimed at the enduser. * @note * 'an Exception object aimed directly at the enduser' should be considered * as error message to be consumed by the user boxed in an Exception object. * Imagine for example you write a calculator. When your (correctly working) parse method fails * while parsing it's input, it is most likely that the user who indirectly * supplied it with an invalid expression is responsible for this problem, * so he is the one who should 'catch' your exception. Thus you will do something * like * @code * if(parsing_failed) * throw UserFault("not a valid expression: " + expr); * @endcode * The client code of your calculator class may look like this: * @code * try * { * double result = calculator.parseExpr(expr); * cout << "expr = " << result; * } * catch(const UserFault& fault) * { * cout << fault << endl; * } * @endcode */class UserFault : public Exception{ public: /** Constructs a new UserFault from msg.*/ UserFault(const std::string& msg) throw(); /** Constructs a new UserFault from filename, linenumber and msg.*/ UserFault(const char* filename, int linenumber, const std::string& msg) throw(); /** Constructs a new UserFault from cause.*/ UserFault(const std::exception& cause, const std::string& msg) throw(); virtual const std::string& getMessage() const throw(); virtual ~UserFault() throw(); protected: UserFault(const std::string& msg, const DontManipulateMsg& dummy) throw(); private: std::string _message;};}//namespace#endif