remove var operation error (#4053)

* remove var operation error

* dang it darglint
This commit is contained in:
Khaleel Al-Adhami 2024-10-03 15:58:04 -07:00 committed by GitHub
parent 73e8a4e0ab
commit 0f8630fb2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -431,25 +431,12 @@ class App(MiddlewareMixin, LifespanMixin, Base):
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,