Method: StandardError#to_hash

Defined in:
lib/coaster/core_ext/standard_error.rb

#to_hashObject



126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/coaster/core_ext/standard_error.rb', line 126

def to_hash
  hash = @attributes.merge(
    type: self.class.name, status: status,
    http_status: http_status, message: message
  )
  if cause
    if cause.respond_to?(:to_hash)
      hash[:cause] = cause.to_hash
    else
      hash[:cause] = cause
    end
  end
  hash
end