diff --git a/include/dali/core/error_handling.h b/include/dali/core/error_handling.h index 5bf04e34f8..fb88d1a0ee 100644 --- a/include/dali/core/error_handling.h +++ b/include/dali/core/error_handling.h @@ -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) {}