3 This file is part of libmspcore
4 Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
7 #ifndef MSP_CORE_ERROR_H_
8 #define MSP_CORE_ERROR_H_
12 #include "backtrace.h"
17 Base class for all Msp exceptions.
19 class Exception: public std::exception
22 Exception(const std::string &);
23 ~Exception() throw() { }
25 const char *what() const throw() { return w.c_str(); }
26 const Backtrace &get_backtrace() const throw() { return bt; }
34 Thrown when a function parameter has an invalid value.
36 class InvalidParameterValue: public Exception
39 InvalidParameterValue(const std::string &w_): Exception(w_) { }
43 Thrown when the current object state doesn't allow the requested action.
45 class InvalidState: public Exception
48 InvalidState(const std::string &w_): Exception(w_) { }
52 Thrown when the application is invoked with wrong parameters.
54 class UsageError: public Exception
57 UsageError(const std::string &r, bool b=true): Exception(r), brief(b) { }
58 bool get_brief() const { return brief; }
64 Thrown when a system call fails.
66 class SystemError: public Exception
69 SystemError(const std::string &, int);
70 int get_error_code() const { return err; }
74 static std::string build_what(const std::string &, int);