|
| ValOutOfRange (const std::string &var_desc, C val, C inf, C sup, const std::string &context) throw () |
| Construct the exception; minBound and maxBound are the bounds of the valid index range (inclusive). More...
|
|
|
virtual C | val () const throw () |
| Get the value that caused the index to go out-of-bounds. More...
|
|
virtual C | inf () const throw () |
| Get the minimum allowed value for this index. More...
|
|
virtual C | sup () const throw () |
| Get the maximum allowed value for this index. More...
|
|
virtual const char * | type () const throw () |
| Get the value that caused the index to go out-of-bounds. More...
|
|
virtual std::string | desc () const throw () |
| Get the value that caused the index to go out-of-bounds. More...
|
|
| OutOfRange (const std::string &var_desc, const std::string &context) throw () |
|
| ~OutOfRange () throw () |
|
virtual std::string | var_desc () const throw () |
| Get a short description of the variable that has been checked. More...
|
|
| Consistency (const std::string &context, const std::string &error=std::string()) throw () |
|
| ~Consistency () throw () |
|
| Generic () throw () |
|
| Generic (const std::string &context) throw () |
|
virtual | ~Generic () throw () |
|
virtual const std::string & | fullInfo () const throw () |
| Format in a string all available information about the exception. More...
|
|
virtual const char * | what () const throw () |
|
| Context () throw () |
|
| Context (const std::string &context) throw () |
|
void | addContext (const std::string &c) throw () |
|
std::string | formatContext () const throw () |
|
const std::vector< std::string > & | context () const throw () |
|
template<class C>
class wibble::exception::ValOutOfRange< C >
Exception thrown when index checking fails.
This exception is to be thrown when an index checking fails, providing informations on the acceptable index range and on the offending value. The context should be a description of the index, possibly preceeded by a description of in what context did the index checking happen.
Example:
if (age < 18)
throw IndexOutOfRangeException("age", age, 18, 0, "obtaining driver license");
if (i < 0 || i > 100)
throw IndexOutOfRangeException("percentage of items sold", i, 0, 100, "checking input consistency");