Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated error handler to have subject and better mesage

  • Loading branch information...
commit d0f22c72110b8e7eeba8780924ef19b9c2797679 1 parent 5b8e03d
@jashmenn authored
View
3  app/controllers/order_gateway_input_controller.rb
@@ -28,7 +28,8 @@ def create
@errors.each { |e| logger.warn "OrderCreator exisiting order: #{e.class}: #{e.message}" }
format.xml { render :status => :accepted } # 202 :accepted
else
- SogiExtension.on_importing_error("a problem, todo add more info") # if SogiExtension.respond_to?(:on_importing_error)
+ error_message = @errors.inject("") { |memo,e| memo << "OrderCreator Exception: #{e.class}: #{e.message}\n\t#{e.backtrace.join("\n\t")}\n"; memo }
+ SogiExtension.on_importing_error("a problem, todo add more info", error_message) # if SogiExtension.respond_to?(:on_importing_error)
@errors.each { |e| logger.fatal "OrderCreator Exception: #{e.class}: #{e.message}\n\t#{e.backtrace.join("\n\t")}" }
format.xml { render :status => :unprocessable_entity }
end
View
6 sogi_extension.rb
@@ -29,9 +29,9 @@ class SogiExtension < Spree::Extension
# have to get this done. Someone please submit a patch for good callbacks in
# this case.
unless self.respond_to?(:on_importing_error)
- def self.on_importing_error(message)
- ActiveRecord::Base.logger.fatal "There was a serious problem importing. You'd better check it out: #{message}"
- AmazonOrdersMailer.deliver_error(message)
+ def self.on_importing_error(subject, message=nil)
+ ActiveRecord::Base.logger.fatal "There was a serious problem importing. You'd better check it out: #{subject} #{message}"
+ AmazonOrdersMailer.deliver_error(subject, message)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.