# Leonetienne/Hazelnupp: Hazelnp::HazelnuppConstraintTypeMissmatch Class Reference

Hazelnp::HazelnuppConstraintTypeMissmatch Class Reference

Gets thrown when a parameter is of a type that does not match the required type, and is not convertible to it. More...

`#include <HazelnuppException.h>`

Inheritance diagram for Hazelnp::HazelnuppConstraintTypeMissmatch:
[legend]
Collaboration diagram for Hazelnp::HazelnuppConstraintTypeMissmatch:
[legend]

## Public Member Functions

| HazelnuppConstraintTypeMissmatch ()
| HazelnuppConstraintTypeMissmatch (const std::string &msg)
| HazelnuppConstraintTypeMissmatch (const std::string &key, const DATA_TYPE requiredType, const DATA_TYPE actualType, const std::string &paramDescription="")
Public Member Functions inherited from Hazelnp::HazelnuppConstraintException
| HazelnuppConstraintException ()
| HazelnuppConstraintException (const std::string &msg)
Public Member Functions inherited from Hazelnp::HazelnuppException
| HazelnuppException ()
| HazelnuppException (const std::string &msg)
const std::string & | What () const
| Will return an error message. More...

## Additional Inherited Members

Protected Attributes inherited from Hazelnp::HazelnuppException
std::string | message

## Detailed Description

Gets thrown when a parameter is of a type that does not match the required type, and is not convertible to it.

Definition at line 56 of file HazelnuppException.h.

## Constructor & Destructor Documentation

## HazelnuppConstraintTypeMissmatch() [1/3]

Hazelnp::HazelnuppConstraintTypeMissmatch::HazelnuppConstraintTypeMissmatch | ( |  | ) |

inline

Definition at line 59 of file HazelnuppException.h.

: HazelnuppConstraintException() {};
Hazelnp::HazelnuppConstraintException::HazelnuppConstraintException
HazelnuppConstraintException()
Definition: HazelnuppException.h:50

## HazelnuppConstraintTypeMissmatch() [2/3]

Hazelnp::HazelnuppConstraintTypeMissmatch::HazelnuppConstraintTypeMissmatch | ( | const std::string & | msg | ) |

inline

Definition at line 60 of file HazelnuppException.h.

: HazelnuppConstraintException(msg) {};

## HazelnuppConstraintTypeMissmatch() [3/3]

Hazelnp::HazelnuppConstraintTypeMissmatch::HazelnuppConstraintTypeMissmatch | ( | const std::string & | key,
|  | const DATA_TYPE | requiredType,
|  | const DATA_TYPE | actualType,
|  | const std::string & | paramDescription = `""`
| ) |  |

inline

Definition at line 62 of file HazelnuppException.h.

{
// Generate descriptive error message
std::stringstream ss;
ss << "Cannot convert parameter " << key << " to type " << DataTypeToString(requiredType)
<< ". You supplied type: " << DataTypeToString(actualType) << ".";
// Add the parameter description, if provided
if (paramDescription.length() > 0)
ss << std::endl << key << " => " << paramDescription;
message = ss.str();
return;
};
Hazelnp::HazelnuppException::message
std::string message
Definition: HazelnuppException.h:24
Hazelnp::DataTypeToString
static std::string DataTypeToString(DATA_TYPE type)
Definition: DataType.h:17

The documentation for this class was generated from the following file:

- include/Hazelnupp/HazelnuppException.h