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

Instance Attribute Summary

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 Method Details

.define_error_lists(*error_list_array) ⇒ Object



111
112
113
114
115
# File 'lib/bing_ads_ruby_sdk/errors/errors.rb', line 111

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

  error_list_array.each { |attr| attr_accessor attr }
end

.error_listsObject



107
108
109
# File 'lib/bing_ads_ruby_sdk/errors/errors.rb', line 107

def error_lists
  @error_lists ||= []
end

.error_lists=(value) ⇒ Object



103
104
105
# File 'lib/bing_ads_ruby_sdk/errors/errors.rb', line 103

def error_lists=(value)
  @error_lists = value
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