Skip to content

Commit

Permalink
handle validation error from create_new_run
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Jul 6, 2024
1 parent e2b21a0 commit 142d895
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion daras_ai_v2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from fastapi import HTTPException
from firebase_admin import auth
from furl import furl
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, ValidationError
from sentry_sdk.tracing import (
TRANSACTION_SOURCE_ROUTE,
)
Expand Down Expand Up @@ -1583,6 +1583,10 @@ def on_submit(self):

try:
sr = self.create_new_run(enable_rate_limits=True)
except ValidationError as e:
st.session_state[StateKeys.run_status] = None
st.session_state[StateKeys.error_msg] = str(e)
return
except RateLimitExceeded as e:
st.session_state[StateKeys.run_status] = None
st.session_state[StateKeys.error_msg] = e.detail.get("error", "")
Expand Down

0 comments on commit 142d895

Please sign in to comment.