Exception: Fanforce::Error::AddonFailed
Overview
A 3rd-party addon crapped out
Instance Attribute Summary collapse
#env, #public_errors
Class Method Summary
collapse
Instance Method Summary
collapse
#code, #curl_command, #for, #format_error, #format_errors
Constructor Details
#initialize(plugin_type, plugin_id, e, msg, &block) ⇒ AddonFailed
Returns a new instance of AddonFailed.
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# File 'lib/fanforce/errors/errors.rb', line 112
def initialize(plugin_type, plugin_id, e, msg, &block)
plugin_dev_error = {}
plugin_dev_error[:problem] = msg
if e.is_a?(Fanforce::Errors::WebhookFailed)
plugin_dev_error[:request_url] = e.request_url
plugin_dev_error[:request_params] = e.request_params
plugin_dev_error[:response_code] = e.response_code
plugin_dev_error[:response_body] = e.response_body.to_s
plugin_dev_error[:curl_command] = "curl -X POST -d \"#{e.request_params.to_param}\" #{e.request_url}"
end
@plugin_dev_errors = e.respond_to?(:plugin_dev_errors) ? e.plugin_dev_errors : []
@plugin_dev_errors << plugin_dev_error
self.class.handler_blocks.each {|block| block.call(plugin_type, plugin_id, plugin_dev_error, e.backtrace) }
super(msg)
end
|
Instance Attribute Details
#plugin_dev_error ⇒ Object
Returns the value of attribute plugin_dev_error.
107
108
109
|
# File 'lib/fanforce/errors/errors.rb', line 107
def plugin_dev_error
@plugin_dev_error
end
|
Class Method Details
.handler(&block) ⇒ Object
129
130
131
|
# File 'lib/fanforce/errors/errors.rb', line 129
def self.handler(&block)
handler_blocks << block
end
|
.handler_blocks ⇒ Object
133
134
135
|
# File 'lib/fanforce/errors/errors.rb', line 133
def self.handler_blocks
@handler_blocks ||= []
end
|
Instance Method Details
#default_error_code ⇒ Object
110
|
# File 'lib/fanforce/errors/errors.rb', line 110
def default_error_code; :third_party_error end
|
#default_message ⇒ Object
108
|
# File 'lib/fanforce/errors/errors.rb', line 108
def default_message; 'Third-Party Plugin Error' end
|
#valid_error_codes ⇒ Object
109
|
# File 'lib/fanforce/errors/errors.rb', line 109
def valid_error_codes; [:third_party_error] end
|