module Jekyll::Algolia::ErrorHandler

def self.unknown_setting?(error, context = {})

issue.
not available. We'll tell the user which one so they can fix their
The API will block any call that tries to update a setting value that is

context[:settings] - The settings passed to update the index

Public: Check if one of the index settings is invalid
def self.unknown_setting?(error, context = {})
  details = error_hash(error.message)
  return false if details == false
  message = details['message']
  return false if message !~ /^Invalid object attributes.*/
  # Getting the unknown setting name
  regex = /^Invalid object attributes: (.*) near line.*/
  setting_name, = regex.match(message).captures
  setting_value = context[:settings][setting_name]
  {
    'setting_name' => setting_name,
    'setting_value' => setting_value
  }
end