Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ismael-sarmiento/kimera_python/llms.txt
Use this file to discover all available pages before exploring further.
ExceptionsUtils is a static-method utility class that centralises the repetitive pattern of validating required keys before a function proceeds. Rather than scattering if key not in options: raise Exception(...) blocks across your codebase, you delegate that check to a single, consistently worded guard. The resulting error messages are human-readable and actionable, making misconfiguration obvious at development time.
Import
raise_exception_if_key_not_in_dict
Checks whether key is present in _dict and raises an Exception with a descriptive message if it is not. The check uses Python’s in operator, so it works with any mapping type including plain dict and unpacked **kwargs.
The key that must be present in the dictionary. No type annotation is defined in the source — any hashable value is accepted. The key is used verbatim in the error message.
The dictionary (or any mapping) to inspect. No type annotation is defined in the source. No exception is raised when
key is found.Exception with message Key {key} not defined in options. Please define it! when the key is absent.
Using ExceptionsUtils in Your Own Code
The guard is most effective at the entry point of any function that accepts an options dictionary or variadic keyword arguments. Placing all checks before any business logic ensures that the function either receives everything it needs or fails immediately with a clear message — never silently mid-execution.
The raised exception is a plain
Exception, not a subclass such as KeyError or ValueError. Catch it with a bare except Exception or let it propagate to the top-level error handler.