feat: specify robot name and error message

This commit is contained in:
Rohit
2025-05-27 23:46:56 +05:30
parent c47640dcda
commit 0aae146c6d

View File

@@ -255,17 +255,20 @@ async function executeRun(id: string, userId: string) {
finishedAt: new Date().toLocaleString(), finishedAt: new Date().toLocaleString(),
}); });
const recording = await Robot.findOne({ where: { 'recording_meta.id': run.robotMetaId }, raw: true });
// Trigger webhooks for run failure // Trigger webhooks for run failure
const failedWebhookPayload = { const failedWebhookPayload = {
robot_id: run.robotMetaId, robot_id: run.robotMetaId,
run_id: run.runId, run_id: run.runId,
robot_name: 'Unknown Robot', robot_name: recording ? recording.recording_meta.name : 'Unknown Robot',
status: 'failed', status: 'failed',
started_at: run.startedAt, started_at: run.startedAt,
finished_at: new Date().toLocaleString(), finished_at: new Date().toLocaleString(),
error: { error: {
message: "Failed: Recording not found", message: error.message,
type: 'RecodingNotFoundError' stack: error.stack,
type: error.name || 'ExecutionError'
}, },
metadata: { metadata: {
browser_id: run.browserId, browser_id: run.browserId,