MCPcopy Index your code
hub / github.com/reflex-dev/reflex / _modify_exception

Function _modify_exception

reflex/compiler/compiler.py:818–841  ·  view source on GitHub ↗

Modify the exception to make it more readable. Args: e: The exception to modify.

(e: Exception)

Source from the content-addressed store, hash-verified

816
817
818def _modify_exception(e: Exception) -> None:
819 """Modify the exception to make it more readable.
820
821 Args:
822 e: The exception to modify.
823 """
824 if len(e.args) == 1 and isinstance((msg := e.args[0]), str):
825 while (state_index := msg.find("reflex___")) != -1:
826 dot_index = msg.find(".", state_index)
827 if dot_index == -1:
828 break
829 state_name = msg[state_index:dot_index]
830 module_dot_state_name = state_name.replace("___", ".").rsplit("__", 1)[-1]
831 module_path, _, state_snake_case = module_dot_state_name.rpartition(".")
832 if not state_snake_case:
833 break
834 actual_state_name = to_title_case(state_snake_case)
835 msg = (
836 f"{msg[:state_index]}{module_path}.{actual_state_name}{msg[dot_index:]}"
837 )
838
839 msg = msg.replace(FIELD_MARKER, "")
840
841 e.args = (msg,)
842
843
844def into_component(component: Component | ComponentCallable) -> Component:

Callers 1

into_componentFunction · 0.85

Calls 2

to_title_caseFunction · 0.90
replaceMethod · 0.80

Tested by

no test coverage detected