Method: Appfuel::Response.error
- Defined in:
- lib/appfuel/response.rb
.error(data) ⇒ Object
Convience method for creating an error response. It understands how to handle a SpCore::Error object. Any thing that is not a hash or can’t be converted to a hash is assumed to be a string and converted into a general_error
42 43 44 45 46 |
# File 'lib/appfuel/response.rb', line 42 def error(data) result = format_result_hash(data, default_key: :general_error) result = result[:errors] if result.key?(:errors) self.new(errors: result) end |