Skip to content

Commit

Permalink
remove var operation error (#4053)
Browse files Browse the repository at this point in the history
* remove var operation error

* dang it darglint
  • Loading branch information
adhami3310 authored Oct 3, 2024
1 parent 73e8a4e commit 0f8630f
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions reflex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,25 +431,12 @@ def _generate_component(component: Component | ComponentCallable) -> Component:
The generated component.
Raises:
VarOperationTypeError: When an invalid component var related function is passed.
TypeError: When an invalid component function is passed.
exceptions.MatchTypeError: If the return types of match cases in rx.match are different.
"""
from reflex.utils.exceptions import VarOperationTypeError

try:
return component if isinstance(component, Component) else component()
except exceptions.MatchTypeError:
raise
except TypeError as e:
message = str(e)
if "Var" in message:
raise VarOperationTypeError(
"You may be trying to use an invalid Python function on a state var. "
"When referencing a var inside your render code, only limited var operations are supported. "
"See the var operation docs here: https://reflex.dev/docs/vars/var-operations/"
) from e
raise e

def add_page(
self,
Expand Down

0 comments on commit 0f8630f

Please sign in to comment.