From 81700d2214250102316af66b38c825044e1ee191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zientkiewicz?= Date: Mon, 9 Dec 2024 16:25:28 +0100 Subject: [PATCH] Document invalid_key class. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MichaƂ Zientkiewicz --- include/dali/core/error_handling.h | 9 +++++++++ 1 file changed, 9 insertions(+) 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) {}