lib/rimless/avro_utils.rb
def validate_file(dest)
      JSON.load(dest)
    rescue JSON::ParserError => e
      path = File.expand_path(dest.is_a?(File) ? dest.path : dest.to_s)
      prefix = "Invalid JSON detected: #{path}"
      Rimless.logger.fatal("#{prefix}\n#{e.message}")
      e.message.prepend("#{prefix} - ")
      raise e
    end
# Check the given file for valid JSON.
#
# @param dest [Pathname, File, IO] the file to check
# @raise [JSON::ParserError] when invalid
#
# rubocop:disable Security/JSONLoad because we wrote the file contents
Check the given file for valid JSON.
Check the given file for valid JSON .
def validate_file(dest)
      JSON.load(dest)
    rescue JSON::ParserError => e
      path = File.expand_path(dest.is_a?(File) ? dest.path : dest.to_s)
      prefix = "Invalid JSON detected: #{path}"
      Rimless.logger.fatal("#{prefix}\n#{e.message}")
      e.message.prepend("#{prefix} - ")
      raise e
    end
def validate_file ( dest ) JSON . load ( dest ) rescue JSON :: ParserError => e path = File . expand_path ( dest . is_a? ( File ) ? dest . path : dest . to_s ) prefix = "Invalid JSON detected: #{path}" Rimless . logger . fatal ( "#{prefix}\n#{e.message}" ) e . message . prepend ( "#{prefix} - " ) raise e end
Check the given file for valid JSON.
Check the given file for valid JSON .
[JSON::ParserError] when invalid rubocop:disable Security/JSONLoad because we wrote the file contents
[ JSON :: ParserError ] when invalid rubocop : disable Security / JSONLoad because we wrote the file contents
dest
the file to check
the file to check