Exception: BingAdsRubySdk::Errors::ApplicationFault

Inherits:
GeneralError
  • Object
show all
Defined in:
lib/bing_ads_ruby_sdk/errors/errors.rb

Overview

Base exception class for handling errors where the detail is supplied

Class Attribute Summary collapse

Attributes inherited from GeneralError

#raw_response

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ApplicationFault

Returns a new instance of ApplicationFault.



38
39
40
41
42
# File 'lib/bing_ads_ruby_sdk/errors/errors.rb', line 38

def initialize(response)
  super

  populate_error_lists
end

Class Attribute Details

.error_listsObject



105
106
107
# File 'lib/bing_ads_ruby_sdk/errors/errors.rb', line 105

def error_lists
  @error_lists ||= []
end

Class Method Details

.define_error_lists(*error_list_array) ⇒ Object



109
110
111
112
113
# File 'lib/bing_ads_ruby_sdk/errors/errors.rb', line 109

def define_error_lists(*error_list_array)
  self.error_lists += error_list_array

  error_list_array.each { |attr| attr_accessor attr }
end

Instance Method Details

#messageObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/bing_ads_ruby_sdk/errors/errors.rb', line 44

def message
  error_list = all_errors
  return @message if error_list.empty?

  first_message = first_error_message(error_list)
  if error_list.count > 1
    "API raised #{error_list.count} errors, including: #{first_message}"
  else
    first_message
  end
end