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:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user