Leonetienne/Hazelnupp
Simple, easy to use, command line parameter interface
HazelnuppException.h
Go to the documentation of this file.
1 #pragma once
2 #include <stdexcept>
3 
4 namespace Hazelnp
5 {
6  /** Generic hazelnupp exception
7  */
8  class HazelnuppException : public std::exception
9  {
10  public:
12  HazelnuppException(const std::string& msg) : message{ msg } {};
13 
14  //! Will return an error message
15  const std::string& What() const
16  {
17  return message;
18  }
19 
20  protected:
21  std::string message;
22  };
23 
24  /** Gets thrown when an non-existent key gets dereferenced
25  */
27  {
28  public:
30  HazelnuppInvalidKeyException(const std::string& msg) : HazelnuppException(msg) {};
31  };
32 
33  /** Gets thrown when an attempt is made to retrieve the wrong data type from a value, when the value not convertible
34  */
36  {
37  public:
39  HazelnuppValueNotConvertibleException(const std::string& msg) : HazelnuppException(msg) {};
40  };
41 
42  /** Gets thrown something bad happens because of parameter constraints
43  */
45  {
46  public:
48  HazelnuppConstraintException(const std::string& msg) : HazelnuppException(msg) {};
49  };
50 
51  /** Gets thrown when a parameter is of a type that does not match the required type, and is not convertible to it
52  */
54  {
55  public:
58  };
59 
60  /** Gets thrown when a parameter constrained to be required is not provided, and has no default value set
61  */
63  {
64  public:
67  };
68 }
Hazelnp
Definition: DataType.h:4
Hazelnp::HazelnuppInvalidKeyException::HazelnuppInvalidKeyException
HazelnuppInvalidKeyException(const std::string &msg)
Definition: HazelnuppException.h:30
Hazelnp::HazelnuppConstraintException::HazelnuppConstraintException
HazelnuppConstraintException()
Definition: HazelnuppException.h:47
Hazelnp::HazelnuppInvalidKeyException
Gets thrown when an non-existent key gets dereferenced.
Definition: HazelnuppException.h:26
Hazelnp::HazelnuppConstraintException::HazelnuppConstraintException
HazelnuppConstraintException(const std::string &msg)
Definition: HazelnuppException.h:48
Hazelnp::HazelnuppException::HazelnuppException
HazelnuppException(const std::string &msg)
Definition: HazelnuppException.h:12
Hazelnp::HazelnuppException::What
const std::string & What() const
Will return an error message.
Definition: HazelnuppException.h:15
Hazelnp::HazelnuppConstraintMissingValue::HazelnuppConstraintMissingValue
HazelnuppConstraintMissingValue()
Definition: HazelnuppException.h:65
Hazelnp::HazelnuppConstraintTypeMissmatch::HazelnuppConstraintTypeMissmatch
HazelnuppConstraintTypeMissmatch()
Definition: HazelnuppException.h:56
Hazelnp::HazelnuppConstraintException
Gets thrown something bad happens because of parameter constraints.
Definition: HazelnuppException.h:44
Hazelnp::HazelnuppConstraintMissingValue::HazelnuppConstraintMissingValue
HazelnuppConstraintMissingValue(const std::string &msg)
Definition: HazelnuppException.h:66
Hazelnp::HazelnuppException
Generic hazelnupp exception.
Definition: HazelnuppException.h:8
Hazelnp::HazelnuppConstraintMissingValue
Gets thrown when a parameter constrained to be required is not provided, and has no default value set...
Definition: HazelnuppException.h:62
Hazelnp::HazelnuppConstraintTypeMissmatch
Gets thrown when a parameter is of a type that does not match the required type, and is not convertib...
Definition: HazelnuppException.h:53
Hazelnp::HazelnuppException::HazelnuppException
HazelnuppException()
Definition: HazelnuppException.h:11
Hazelnp::HazelnuppException::message
std::string message
Definition: HazelnuppException.h:21
Hazelnp::HazelnuppValueNotConvertibleException::HazelnuppValueNotConvertibleException
HazelnuppValueNotConvertibleException(const std::string &msg)
Definition: HazelnuppException.h:39
Hazelnp::HazelnuppConstraintTypeMissmatch::HazelnuppConstraintTypeMissmatch
HazelnuppConstraintTypeMissmatch(const std::string &msg)
Definition: HazelnuppException.h:57
Hazelnp::HazelnuppValueNotConvertibleException
Gets thrown when an attempt is made to retrieve the wrong data type from a value, when the value not ...
Definition: HazelnuppException.h:35
Hazelnp::HazelnuppValueNotConvertibleException::HazelnuppValueNotConvertibleException
HazelnuppValueNotConvertibleException()
Definition: HazelnuppException.h:38
Hazelnp::HazelnuppInvalidKeyException::HazelnuppInvalidKeyException
HazelnuppInvalidKeyException()
Definition: HazelnuppException.h:29