From 53bc3ceedb17ac928df97e2354413ccb8b17b2d4 Mon Sep 17 00:00:00 2001 From: pikesley Date: Thu, 10 Nov 2016 14:02:19 +0000 Subject: [PATCH] Rescue from TypeErrors when parsing schemas Trapping and binning this exception allowed me to actually use this code in a real-world situation. Crucially (maybe), all the specs still pass --- lib/csvlint/schema.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/csvlint/schema.rb b/lib/csvlint/schema.rb index 8190a8f6..23e46db6 100644 --- a/lib/csvlint/schema.rb +++ b/lib/csvlint/schema.rb @@ -38,6 +38,9 @@ def load_from_json(uri, output_errors = true) else return Schema.from_json_table(uri,json) end + rescue TypeError => e + # NO IDEA what this was even trying to do - SP 20160526 + rescue Csvlint::Csvw::MetadataError => e raise e rescue OpenURI::HTTPError, Errno::ENOENT => e