From 2e13f69fdf61805fbd6f3cb2cfe7813fed744648 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 11 May 2026 16:09:45 +0530 Subject: [PATCH] chore: log errors from context.dev (#14310) This PR updates the way we log errors and results from context.dev to have better visibility on the enrichment process for onboarding --- app/jobs/account/branding_enrichment_job.rb | 5 ++++- .../app/services/enterprise/website_branding_service.rb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/jobs/account/branding_enrichment_job.rb b/app/jobs/account/branding_enrichment_job.rb index 2898604ca..3deb81821 100644 --- a/app/jobs/account/branding_enrichment_job.rb +++ b/app/jobs/account/branding_enrichment_job.rb @@ -3,7 +3,10 @@ class Account::BrandingEnrichmentJob < ApplicationJob def perform(account_id, email) result = WebsiteBrandingService.new(email).perform - return if result.blank? + if result.blank? + Rails.logger.info "[BrandingEnrichment] Enrichment failed for account=#{account_id} email=#{email}" + return + end account = Account.find(account_id) account.name = result[:title] if result[:title].present? diff --git a/enterprise/app/services/enterprise/website_branding_service.rb b/enterprise/app/services/enterprise/website_branding_service.rb index a1925e80d..553317c43 100644 --- a/enterprise/app/services/enterprise/website_branding_service.rb +++ b/enterprise/app/services/enterprise/website_branding_service.rb @@ -34,7 +34,10 @@ module Enterprise::WebsiteBrandingService def process_response(response) @http_status = response.code - raise "API Error: #{response.message} (Status: #{response.code})" unless response.success? + unless response.success? + Rails.logger.warn "[WebsiteBranding] Context.dev returned #{response.code}: #{response.parsed_response}" + return nil + end brand = response.parsed_response&.dig('brand') return nil if brand.blank?