better totp failure reason and error code (#3472)

This commit is contained in:
LawyZheng
2025-09-19 10:08:25 +08:00
committed by GitHub
parent a39ff77bd9
commit 82b2187583
5 changed files with 89 additions and 4 deletions

View File

@@ -695,6 +695,33 @@ class NoTOTPVerificationCodeFound(SkyvernHTTPException):
super().__init__(msg)
class FailedToGetTOTPVerificationCode(SkyvernException):
reason: str | None = None
def __init__(
self,
task_id: str | None = None,
workflow_run_id: str | None = None,
workflow_id: str | None = None,
totp_verification_url: str | None = None,
totp_identifier: str | None = None,
reason: str | None = None,
) -> None:
self.reason = reason
msg = "Failed to get TOTP verification code."
if task_id:
msg += f" task_id={task_id}"
if workflow_run_id:
msg += f" workflow_run_id={workflow_run_id}"
if workflow_id:
msg += f" workflow_id={workflow_id}"
if totp_verification_url:
msg += f" totp_verification_url={totp_verification_url}"
if totp_identifier:
msg += f" totp_identifier={totp_identifier}"
super().__init__(f"Failed to get TOTP verification code. reason: {reason}")
class SkyvernContextWindowExceededError(SkyvernException):
def __init__(self) -> None:
message = "Context window exceeded. Please contact support@skyvern.com for help."