Skip to content

Commit

Permalink
Document invalid_key class.
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Zientkiewicz <[email protected]>
  • Loading branch information
mzient committed Dec 9, 2024
1 parent 777dd78 commit 81700d2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/dali/core/error_handling.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ struct unsupported_exception : std::runtime_error {
explicit unsupported_exception(const std::string &str) : runtime_error(str) {}
};

/** An exception thrown when an invalid dictionary key is provided
*
* The exception denotes an invalid key. It can be thrown when:
* - the key is not found and the function returns a non-nullable type
* - the key doesn't meet some constraints (e.g. a dictionary doesn't accept an empty
* string as a key).
*
* This exception is used at the Python boundary to raise KeyError rather than IndexError.
*/
struct invalid_key : std::out_of_range {
explicit invalid_key(const std::string &message) : std::out_of_range(message) {}
explicit invalid_key(const char *message) : std::out_of_range(message) {}
Expand Down

0 comments on commit 81700d2

Please sign in to comment.