async def _handle_sync_failure(self, error: Exception) -> None:
        """Handle sync failure by updating job status with error details."""
        self.sync_context.logger.error(
            f"Sync job {self.sync_context.sync_job.id} failed: {error}", exc_info=True
        )

        stats = getattr(self.sync_context.progress, "stats", None)

        await sync_job_service.update_status(
            sync_job_id=self.sync_context.sync_job.id,
            status=SyncJobStatus.FAILED,
            current_user=self.sync_context.current_user,
            error=str(error),
            failed_at=datetime.now(),
            stats=stats,
        )
Handle sync failure by updating job status with error details.
backend/airweave/platform/sync/orchestrator.py