Method: FacebookAds::APIError#initialize
- Defined in:
- lib/facebook_ads/errors.rb
#initialize(api_response) ⇒ APIError
Returns a new instance of APIError.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/facebook_ads/errors.rb', line 22 def initialize(api_response) send("headers=", api_response.headers) error_obj = api_response.result @api_response = api_response if error_obj.is_a?(Hash) error_obj = error_obj['error'] if error_obj.has_key?('error') error_obj.each do |k,v| k = "fb_#{k}" if k == 'message' send("#{k}=", v) if ERROR_ATTRS.include?(k.to_sym) end super("#{self.fb_message}: #{self.error_user_title} (fbtrace_id: #{self.fbtrace_id})") else super(error_obj) end end |