Exception: FlexCommerceApi::Error::InternalServer
- Inherits:
-
Base
- Object
- StandardError
- Base
- FlexCommerceApi::Error::InternalServer
show all
- Defined in:
- lib/flex_commerce_api/error/internal_server.rb
Instance Attribute Summary
Attributes inherited from Base
#request_env, #response_env
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#message ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/flex_commerce_api/error/internal_server.rb', line 4
def message
body = response_env.fetch(:body, {"errors" => []})
error = (body)
return "Internal server error" unless error.present?
if error.is_a?(::Enumerable)
title = error.fetch("title", "")
detail = error.fetch("detail", "")
meta = error.fetch("meta", {})
exception = meta.fetch("exception", "")
backtrace = meta.fetch("backtrace", [])
event_id = meta.fetch("event_id", "")
"Internal server error - #{title} #{detail} #{event_id} #{exception} #{backtrace}"
else
"Internal server error - #{error}"
end
end
|
#raven_context ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/flex_commerce_api/error/internal_server.rb', line 21
def raven_context
{
extra: {
body: response_env[:body]
}
}
end
|