class Locomotive::Coal::InvalidResourceError

Private Instance Methods

build_message() click to toggle source
# File lib/locomotive/coal/error.rb, line 65
def build_message
  attributes = (body['attributes'] || body).map do |name, errors|
    if errors.is_a?(Hash)
      errors.map do |k, _errors|
        "#{name}.#{k}: #{_errors.join(' + ')}"
      end
    else
      "#{name} #{errors.join(', ')}"
    end
  end.join(', ')

  body['error'] ? "#{body['error']}: #{attributes}" : attributes
end