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
This commit is contained in:
Shivam Mishra
2026-05-11 16:09:45 +05:30
committed by GitHub
parent bc768bf04f
commit 2e13f69fdf
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -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?
@@ -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?