add webhook failure reason (#3046)
This commit is contained in:
@@ -116,6 +116,7 @@ class WorkflowRun(BaseModel):
|
||||
extra_http_headers: dict[str, str] | None = None
|
||||
proxy_location: ProxyLocation | None = None
|
||||
webhook_callback_url: str | None = None
|
||||
webhook_failure_reason: str | None = None
|
||||
totp_verification_url: str | None = None
|
||||
totp_identifier: str | None = None
|
||||
failure_reason: str | None = None
|
||||
@@ -151,6 +152,7 @@ class WorkflowRunResponseBase(BaseModel):
|
||||
failure_reason: str | None = None
|
||||
proxy_location: ProxyLocation | None = None
|
||||
webhook_callback_url: str | None = None
|
||||
webhook_failure_reason: str | None = None
|
||||
totp_verification_url: str | None = None
|
||||
totp_identifier: str | None = None
|
||||
extra_http_headers: dict[str, str] | None = None
|
||||
|
||||
@@ -1226,6 +1226,7 @@ class WorkflowService:
|
||||
failure_reason=workflow_run.failure_reason,
|
||||
proxy_location=workflow_run.proxy_location,
|
||||
webhook_callback_url=workflow_run.webhook_callback_url,
|
||||
webhook_failure_reason=workflow_run.webhook_failure_reason,
|
||||
totp_verification_url=workflow_run.totp_verification_url,
|
||||
totp_identifier=workflow_run.totp_identifier,
|
||||
extra_http_headers=workflow_run.extra_http_headers,
|
||||
@@ -1390,6 +1391,10 @@ class WorkflowService:
|
||||
resp_code=resp.status_code,
|
||||
resp_text=resp.text,
|
||||
)
|
||||
await app.DATABASE.update_workflow_run(
|
||||
workflow_run_id=workflow_run.workflow_run_id,
|
||||
webhook_failure_reason="",
|
||||
)
|
||||
else:
|
||||
LOG.info(
|
||||
"Webhook failed",
|
||||
@@ -1400,6 +1405,10 @@ class WorkflowService:
|
||||
resp_code=resp.status_code,
|
||||
resp_text=resp.text,
|
||||
)
|
||||
await app.DATABASE.update_workflow_run(
|
||||
workflow_run_id=workflow_run.workflow_run_id,
|
||||
webhook_failure_reason=f"Webhook failed with status code {resp.status_code}, error message: {resp.text}",
|
||||
)
|
||||
except Exception as e:
|
||||
raise FailedToSendWebhook(
|
||||
workflow_id=workflow_id,
|
||||
|
||||
Reference in New Issue
Block a user