Sha256: 7474ff0f9c78534df356042c07467a985d099f734774e265d252e64ed810c1b6
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require "alephant/broker/component_meta" require "alephant/broker/errors/content_not_found" require "alephant/broker/error_component" require "alephant/logger" module Alephant module Broker class ComponentFactory include Logger def initialize(load_strategy) @load_strategy = load_strategy end def create(id, batch_id, options) component_meta = ComponentMeta.new(id, batch_id, options) Component.new( component_meta, @load_strategy.load(component_meta) ) rescue Alephant::Broker::Errors::ContentNotFound => e logger.error( method: 'Broker.ComponentFactory.create', message: 'Exception raised (ContentNotFound)', component_key: component_meta.component_key ) logger.metric "ContentNotFound" ErrorComponent.new(component_meta, 404, e) rescue => e logger.error( method: 'Broker.ComponentFactory.create', message: e.message, backtrace: e.backtrace.join('\n') ) logger.metric "ExceptionRaised" ErrorComponent.new(component_meta, 500, e) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alephant-broker-3.19.1 | lib/alephant/broker/component_factory.rb |
alephant-broker-3.19.0 | lib/alephant/broker/component_factory.rb |