Parse Exception

Parse Exception#

exception rizemind.exception.parse_exception.ParseException(code: str, message: str | None)[source]

Bases: RizemindException

A Pydantic model parse error.

rizemind.exception.parse_exception.catch_parse_errors(func: Callable[[P], R]) Callable[[P], R][source]

Wrap a callable and convert common parse errors to ParseException.

Parameters:

func – The function to wrap.

Returns:

A callable that behaves like func but raises ParseException when a KeyError or Pydantic ValidationError occurs.

Raises:

ParseException – If a KeyError or Pydantic ValidationError is raised by the wrapped callable.